/* ============================================================
   SERMAIN — Panel de administración
   Mismo lenguaje visual que el sitio: oscuro, acento fuego.
   ============================================================ */

:root {
  --bg: #07090f;
  --bg-2: #0b0f18;
  --surface: #10151f;
  --surface-2: #151b28;
  --surface-3: #1b2232;
  --border: rgba(255,255,255,0.08);
  --border-2: rgba(255,255,255,0.14);
  --text: #f4f6fa;
  --text-2: rgba(244,246,250,0.72);
  --text-3: rgba(244,246,250,0.5);
  --primary: #e8391c;
  --primary-2: #ff6b35;
  --primary-soft: rgba(232,57,28,0.12);
  --primary-line: rgba(232,57,28,0.3);
  --grad: linear-gradient(135deg, #e8391c, #ff6b35);
  --ok: #2fbf71;
  --warn: #f5a524;
  --info: #4ea1ff;
  --danger: #ff5a4a;
  --radius: 0.875rem;
  --radius-lg: 1.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-head: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --sidebar-w: 16.5rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); font-size: 0.9375rem; line-height: 1.55; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.02em; line-height: 1.15; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul { list-style: none; }
code { font-family: ui-monospace, monospace; font-size: 0.875em; padding: 0.1em 0.4em; border-radius: 0.375rem; background: rgba(255,255,255,0.08); }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; border-radius: 6px; }
[data-lucide], .lucide { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ===== BOOT ===== */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot__spinner, .spinner { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
.spinner--sm { width: 1rem; height: 1rem; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== BOTONES ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.625rem; padding: 0 1.125rem; border-radius: 0.75rem; border: 1px solid transparent;
  font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 24px -12px rgba(232,57,28,0.8); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 30px -10px rgba(232,57,28,0.9); }
.btn-ghost { background: rgba(255,255,255,0.05); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.09); border-color: var(--border-2); }
.btn-danger { background: rgba(255,90,74,0.12); border-color: rgba(255,90,74,0.3); color: #ff8a7e; }
.btn-danger:hover:not(:disabled) { background: rgba(255,90,74,0.2); }
.btn-wa { background: #25d366; color: #06240f; }
.btn-sm { height: 2.125rem; padding: 0 0.75rem; font-size: 0.8125rem; border-radius: 0.625rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.625rem; color: var(--text-2); transition: background-color 0.2s, color 0.2s; }
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.icon-btn.is-on { color: var(--warn); }
.icon-btn--danger:hover { color: var(--danger); background: rgba(255,90,74,0.12); }

/* ===== FORMULARIOS ===== */
.form { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field { display: grid; gap: 0.375rem; align-content: start; }
.field > span { font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.field small { font-size: 0.75rem; color: var(--text-3); }
.field input, .field select, .field textarea, .input {
  width: 100%; height: 2.75rem; padding: 0 0.875rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-2); border-radius: 0.75rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { height: auto; min-height: 6rem; padding: 0.75rem 0.875rem; resize: vertical; line-height: 1.5; }
.field select { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f4f6fa' stroke-opacity='.6' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; }
.field select option { background: var(--surface-2); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,57,28,0.18); }
.check { display: inline-flex; align-items: center; gap: 0.625rem; font-size: 0.875rem; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { width: 1.125rem; height: 1.125rem; accent-color: var(--primary); }
.alert { padding: 0.75rem 1rem; border-radius: 0.75rem; background: rgba(255,90,74,0.1); border: 1px solid rgba(255,90,74,0.3); color: #ff9a8f; font-size: 0.875rem; }

/* ===== LOGIN / INSTALADOR ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(232,57,28,0.18), transparent 70%), var(--bg); }
.auth__card { width: 100%; max-width: 26rem; padding: 2.25rem 1.75rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 30px 80px -30px rgba(0,0,0,0.9); }
.auth__card > p { color: var(--text-2); margin-bottom: 1rem; }
.auth__logo { width: 12rem; margin: 0 auto 1.75rem; }
.auth__title { font-size: 1.375rem; text-align: center; margin-bottom: 0.5rem; }
.auth__sub { text-align: center; color: var(--text-3); font-size: 0.875rem; margin-bottom: 1.5rem; }
.auth .form { margin-top: 0.5rem; }
.auth__back { display: block; margin-top: 1.25rem; text-align: center; font-size: 0.8125rem; color: var(--text-3); }
.auth__back:hover { color: var(--text); }

/* ===== LAYOUT ===== */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-w);
  display: flex; flex-direction: column; padding: 1.25rem 0.875rem;
  background: var(--bg-2); border-right: 1px solid var(--border);
  transform: translateX(-100%); transition: transform 0.3s var(--ease);
}
.sidebar.is-open { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,0.6); }
.sidebar__logo { width: 9.5rem; margin: 0.25rem 0.5rem 1.75rem; }
.sidebar__label { margin: 0 0.75rem 0.5rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.nav { display: grid; gap: 0.125rem; }
.nav__link { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.75rem; font-weight: 500; color: var(--text-2); transition: background-color 0.2s, color 0.2s; }
.nav__link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav__link.is-active { background: var(--primary-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--primary); }
button.nav__link { width: 100%; text-align: left; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.nav__link.is-active svg { color: var(--primary-2); }
.nav__badge { margin-left: auto; min-width: 1.375rem; height: 1.375rem; padding: 0 0.375rem; display: grid; place-items: center; border-radius: 999px; background: var(--primary); color: #fff; font-size: 0.75rem; font-weight: 700; }
.sidebar__foot { margin-top: auto; display: grid; gap: 0.125rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.sidebar__user { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem 0.75rem; font-size: 0.8125rem; color: var(--text-3); }
.sidebar__avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 700; text-transform: uppercase; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.55); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.scrim.is-open { opacity: 1; visibility: visible; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem; height: 3.75rem; padding: 0 1rem; background: rgba(7,9,15,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar__logo { height: 2rem; width: auto; }
.topbar .icon-btn { color: var(--text); }

.main { padding: 1.5rem 1rem 4rem; max-width: 80rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.625rem; }
.page-head p { color: var(--text-3); font-size: 0.875rem; margin-top: 0.25rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .topbar, .scrim { display: none; }
  .layout { padding-left: var(--sidebar-w); }
  .main { padding: 2.25rem 2.5rem 4rem; }
  .page-head h1 { font-size: 1.875rem; }
}

/* ===== TARJETAS ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--border); }
.card__head h2 { font-size: 1rem; }
.card__body { padding: 1.25rem; }
.section-card + .section-card { margin-top: 1.25rem; }
.section-card .card__head p { font-size: 0.8125rem; color: var(--text-3); margin-top: 0.125rem; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.5rem; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { position: relative; padding: 1.125rem 1.25rem; overflow: hidden; }
.stat__icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; background: var(--primary-soft); color: var(--primary-2); margin-bottom: 0.875rem; }
.stat__num { font-family: var(--font-head); font-size: 1.875rem; font-weight: 800; line-height: 1; }
.stat__label { margin-top: 0.375rem; font-size: 0.8125rem; color: var(--text-3); }
.stat--hot { border-color: var(--primary-line); background: linear-gradient(180deg, rgba(232,57,28,0.1), var(--surface) 70%); }

.quick { display: grid; gap: 0.75rem; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(3, 1fr); } }
.quick a { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; transition: border-color 0.2s, transform 0.2s var(--ease); }
.quick a:hover { border-color: var(--primary-line); transform: translateY(-2px); }
.quick a svg { color: var(--primary-2); }

.dash-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

/* ===== LISTAS ===== */
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 1rem; padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--border); transition: background-color 0.15s; }
.row:last-child { border-bottom: 0; }
button.row, a.row { width: 100%; text-align: left; }
button.row:hover, a.row:hover { background: rgba(255,255,255,0.03); }
.row__main { flex: 1; min-width: 0; }
.row__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { font-size: 0.8125rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__side { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; font-size: 0.8125rem; color: var(--text-3); }
.row--new .row__title::before { content: ''; display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.5rem; border-radius: 50%; background: var(--primary); vertical-align: middle; }
.empty { padding: 3rem 1.5rem; text-align: center; color: var(--text-3); }
.empty svg { width: 2.25rem; height: 2.25rem; margin: 0 auto 0.75rem; opacity: 0.5; }

.pill { display: inline-flex; align-items: center; gap: 0.375rem; height: 1.5rem; padding: 0 0.625rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: currentColor; }
.pill--nueva { background: rgba(232,57,28,0.14); color: #ff8064; }
.pill--contactado { background: rgba(78,161,255,0.14); color: #7dbaff; }
.pill--cerrada { background: rgba(47,191,113,0.14); color: #5fd697; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }
.tab { display: inline-flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.875rem; border-radius: 999px; border: 1px solid var(--border-2); font-size: 0.8125rem; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: all 0.2s; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--grad); border-color: transparent; color: #fff; }
.tab span { font-size: 0.75rem; opacity: 0.8; }

/* ===== GALERÍA ===== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.toolbar .tabs { margin-bottom: 0; }
.bulkbar { position: sticky; top: 0.75rem; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 0.625rem 0.75rem 0.625rem 1.125rem; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--primary-line); box-shadow: 0 20px 40px -20px rgba(0,0,0,0.8); }
@media (max-width: 1023px) { .bulkbar { top: 4.5rem; } }
.bulkbar { flex-wrap: wrap; }
.order-hint { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius); background: rgba(245,165,36,0.1); border: 1px solid rgba(245,165,36,0.3); color: #ffc768; font-size: 0.875rem; }
.order-hint .btn { margin-left: auto; }

.gallery { display: grid; gap: 0.875rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); }
@media (min-width: 1024px) { .gallery { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); } }
.gcard { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color 0.2s, transform 0.2s var(--ease), opacity 0.2s; }
.gcard:hover { border-color: var(--border-2); }
.gcard.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-line); }
.gcard.is-hidden-item .gcard__img img { opacity: 0.35; filter: grayscale(1); }
.gcard.is-dragging { opacity: 0.4; }
.gcard.is-drop-target { border-color: var(--warn); transform: scale(1.02); }
.gcard[draggable="true"] { cursor: grab; }
.gcard__img { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.gcard__img img { width: 100%; height: 100%; object-fit: cover; }
.gcard__select { position: absolute; top: 0.5rem; left: 0.5rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; background: rgba(7,9,15,0.7); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.25); color: #fff; opacity: 0; transition: opacity 0.2s, background-color 0.2s; }
.gcard:hover .gcard__select, .gcard.is-selected .gcard__select, .is-selecting .gcard__select { opacity: 1; }
.gcard.is-selected .gcard__select { background: var(--primary); border-color: var(--primary); }
.gcard__select svg { width: 0.875rem; height: 0.875rem; }
.gcard__badges { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; gap: 0.25rem; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.375rem; padding: 0 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; background: rgba(7,9,15,0.78); backdrop-filter: blur(6px); }
.badge svg { width: 0.75rem; height: 0.75rem; }
.badge--star { color: var(--warn); }
.badge--hidden { color: var(--text-2); }
.gcard__body { padding: 0.625rem 0.75rem 0.25rem; }
.gcard__cat { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard__title { font-size: 0.8125rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.25rem; }
.gcard__actions { display: flex; justify-content: space-between; padding: 0.125rem 0.375rem 0.375rem; }

/* ===== SUBIDA ===== */
.dropzone { display: grid; place-items: center; gap: 0.5rem; padding: 2rem 1rem; border-radius: var(--radius-lg); border: 2px dashed var(--border-2); background: rgba(255,255,255,0.02); text-align: center; color: var(--text-2); cursor: pointer; transition: border-color 0.2s, background-color 0.2s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone svg { width: 2.25rem; height: 2.25rem; color: var(--primary-2); }
.dropzone strong { color: var(--text); }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.5rem; margin-top: 1rem; max-height: 16rem; overflow-y: auto; }
.upload-item { position: relative; aspect-ratio: 1; border-radius: 0.625rem; overflow: hidden; background: var(--surface-2); }
.upload-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-item__state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7,9,15,0.55); color: #fff; }
.upload-item__state svg { width: 1.5rem; height: 1.5rem; }
.upload-item.is-done .upload-item__state { background: rgba(47,191,113,0.35); }
.upload-item.is-error .upload-item__state { background: rgba(255,90,74,0.5); }
.upload-item__remove { position: absolute; top: 0.25rem; right: 0.25rem; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(7,9,15,0.8); color: #fff; }
.upload-item__remove svg { width: 0.875rem; height: 0.875rem; }
.progress { height: 0.375rem; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 1rem; }
.progress__bar { height: 100%; width: 0; background: var(--grad); transition: width 0.3s; }

/* ===== PROYECTOS ===== */
.plist { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }
.pitem { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: border-color 0.2s, opacity 0.2s; }
.pitem.is-dragging { opacity: 0.4; }
.pitem.is-drop-target { border-color: var(--warn); }
.pitem__handle { color: var(--text-3); cursor: grab; padding: 0.25rem; }
.pitem__img { width: 5.5rem; aspect-ratio: 4/3; border-radius: 0.625rem; overflow: hidden; flex-shrink: 0; background: var(--surface-2); }
.pitem__img img { width: 100%; height: 100%; object-fit: cover; }
.pitem__main { flex: 1; min-width: 0; }
.pitem__name { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.pitem__meta { font-size: 0.8125rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem__actions { display: flex; gap: 0.25rem; }
.tag { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.375rem; padding: 0 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; background: rgba(255,255,255,0.07); color: var(--text-2); }
.tag--star { background: rgba(245,165,36,0.14); color: #ffc768; }
.tag svg { width: 0.75rem; height: 0.75rem; }
@media (max-width: 600px) {
  .pitem { gap: 0.625rem; padding: 0.625rem 0.5rem 0.625rem 0.25rem; }
  .pitem__img { width: 4.25rem; }
  .pitem__actions { flex-direction: column; gap: 0; }
}

.img-picker { display: grid; gap: 0.75rem; }
.img-picker__preview { aspect-ratio: 16/10; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px dashed var(--border-2); display: grid; place-items: center; color: var(--text-3); cursor: pointer; }
.img-picker__preview img { width: 100%; height: 100%; object-fit: cover; }
.img-picker__preview { aspect-ratio: auto; height: clamp(11rem, 45vw, 16rem); }
.img-picker__preview--contain { height: 16rem; }
.img-picker__preview--contain img { position: absolute; inset: 0; object-fit: contain; }
.img-picker__preview, .simg__img { position: relative; }
.img-picker__hint { position: absolute; left: 50%; bottom: 0.75rem; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem; border-radius: 999px; background: rgba(7,9,15,0.78); backdrop-filter: blur(6px); color: #fff; font-size: 0.75rem; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.img-picker__hint svg { width: 0.875rem; height: 0.875rem; }
.img-picker__preview:hover .img-picker__hint, .simg__img:hover .img-picker__hint { opacity: 1; }
@media (hover: none) { .img-picker__hint { opacity: 1; } }
.img-picker__preview.is-changed { border: 2px solid var(--primary); }

/* ===== CATEGORÍAS ===== */
.cat-list { display: grid; gap: 0.5rem; margin-bottom: 1rem; grid-template-columns: minmax(0, 1fr); }
.cat-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.375rem 0.375rem 0.25rem; border-radius: 0.75rem; background: var(--surface-2); border: 1px solid var(--border); }
.cat-item.is-dragging { opacity: 0.4; }
.cat-item__name { flex: 1; min-width: 0; height: 2.25rem; padding: 0 0.625rem; border-radius: 0.5rem; background: transparent; border: 1px solid transparent; outline: none; font-weight: 600; transition: border-color 0.2s, background-color 0.2s; }
.cat-item__name:hover { border-color: var(--border-2); }
.cat-item__name:focus { border-color: var(--primary); background: rgba(255,255,255,0.04); }
.cat-item__count { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }
.cat-add { display: flex; gap: 0.5rem; }
.cat-add input { flex: 1; min-width: 0; height: 2.625rem; padding: 0 0.875rem; background: rgba(255,255,255,0.04); border: 1px solid var(--border-2); border-radius: 0.75rem; outline: none; }
.cat-add input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,57,28,0.18); }
.select-sm { height: 2.125rem; padding: 0 0.625rem; border-radius: 0.625rem; background: var(--surface-2); border: 1px solid var(--border-2); font-size: 0.8125rem; font-weight: 600; outline: none; cursor: pointer; }
.select-sm option { background: var(--surface-2); }

/* ===== IMÁGENES DEL SITIO ===== */
.simg-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.simg { display: flex; flex-direction: column; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; transition: opacity 0.2s; }
.simg.is-loading { opacity: 0.5; pointer-events: none; }
.simg__img { display: block; aspect-ratio: 16/9; background: var(--surface-3); cursor: pointer; overflow: hidden; }
.simg__img img { width: 100%; height: 100%; object-fit: cover; }
.simg__body { padding: 0.75rem 0.875rem 0.25rem; flex: 1; }
.simg__title { font-weight: 700; font-size: 0.9375rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.simg__meta { font-size: 0.8125rem; color: var(--text-3); margin-top: 0.125rem; }
.simg__actions { display: flex; gap: 0.5rem; padding: 0.625rem 0.875rem 0.875rem; }

/* ===== MODAL Y DRAWER ===== */
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); animation: fade 0.2s; }
@media (min-width: 640px) { .overlay { align-items: center; padding: 1.5rem; } }
.modal { width: 100%; max-width: 34rem; max-height: 92vh; display: flex; flex-direction: column; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface); border: 1px solid var(--border-2); box-shadow: 0 40px 100px -30px rgba(0,0,0,0.9); animation: rise 0.3s var(--ease); }
@media (min-width: 640px) { .modal { border-radius: var(--radius-lg); } }
.modal--wide { max-width: 44rem; }
.modal--sm { max-width: 26rem; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.125rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: 1.0625rem; }
.modal__body { padding: 1.25rem; overflow-y: auto; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.modal__foot .spacer { margin-right: auto; }

.drawer-overlay { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: 100%; max-width: 30rem; height: 100%; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border-2); animation: slide 0.3s var(--ease); }
.drawer .modal__body { flex: 1; }
.kv { display: grid; gap: 0.875rem; margin-bottom: 1.25rem; }
.kv dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.kv dd { margin-top: 0.125rem; word-break: break-word; }
.kv dd.msg { white-space: pre-wrap; padding: 0.75rem 0.875rem; border-radius: 0.75rem; background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-2); }
.contact-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 1.5rem; }
.contact-actions .btn { padding: 0 0.5rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; padding: 0.25rem; border-radius: 0.875rem; background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.segmented button { height: 2.25rem; border-radius: 0.625rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-2); }
.segmented button.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ===== TOASTS ===== */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: grid; gap: 0.5rem; width: calc(100% - 2rem); max-width: 26rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 0.625rem; padding: 0.75rem 1rem; border-radius: 0.875rem; background: var(--surface-3); border: 1px solid var(--border-2); box-shadow: 0 20px 40px -12px rgba(0,0,0,0.8); font-size: 0.875rem; animation: rise 0.3s var(--ease); pointer-events: auto; }
.toast svg { width: 1.125rem; height: 1.125rem; }
.toast--ok svg { color: var(--ok); }
.toast--error { border-color: rgba(255,90,74,0.4); }
.toast--error svg { color: var(--danger); }

/* ===== PÁGINA DE AJUSTES ===== */
.settings-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; padding: 1rem 0; background: linear-gradient(transparent, var(--bg) 35%); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

/* ===== CELULAR Y PANTALLAS TÁCTILES ===== */
.hint { font-size: 0.8125rem; margin-bottom: 1rem; }
.hint svg { width: 0.875rem; height: 0.875rem; vertical-align: -2px; }
.hint--touch, .grip, .filter-select { display: none; }
[data-grip] { touch-action: none; cursor: grab; }
.bulkbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* Sin mouse no hay "hover": lo que dependía de él queda siempre visible */
@media (hover: none) {
  .gcard__select { opacity: 1; }
  .hint--mouse { display: none; }
  .hint--touch { display: inline; }
  .grip { display: inline-grid; }
  .gcard[draggable="true"] { cursor: default; }
}

@media (max-width: 600px) {
  .filter-select { display: block; width: 100%; }
  .filter-select select { width: 100%; height: 2.625rem; font-size: 0.875rem; }
  .tabs--gallery { display: none; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.625rem; }
  .gcard__body { padding: 0.5rem 0.625rem 0.125rem; }
  .gcard__actions { padding: 0 0.25rem 0.25rem; }
  .gcard__actions .icon-btn { width: 1.875rem; height: 2rem; }
  .gallery.is-selecting { margin-bottom: 7rem; }
  /* La barra de selección se fija abajo para no tapar las fotos */
  .bulkbar { position: fixed; top: auto; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; z-index: 60; margin: 0; padding: 0.625rem 0.75rem; gap: 0.5rem; }
  .bulkbar__actions { width: 100%; flex-wrap: nowrap; }
  .bulkbar__actions select { flex: 1; min-width: 0; }
  .bulkbar__actions .btn { padding: 0 0.625rem; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1; }
}
@media (max-width: 600px) {
  /* Imágenes del sitio: miniatura a la izquierda para no ocupar toda la pantalla */
  .simg-grid { gap: 0.625rem; }
  .simg { display: grid; grid-template-columns: 7rem minmax(0, 1fr); }
  .simg__img { grid-row: span 2; aspect-ratio: auto; height: 100%; min-height: 6.5rem; }
  .simg__img .img-picker__hint { display: none; }
  .simg__body { padding: 0.625rem 0.75rem 0; }
  .simg__actions { flex-wrap: wrap; padding: 0.5rem 0.75rem 0.625rem; }
}
@media (max-width: 767px) {
  /* En iPhone, un campo con letra menor a 16px hace zoom al tocarlo */
  .field input, .field select, .field textarea, .cat-add input, .cat-item__name, .select-sm { font-size: 16px; }
}

/* ===== SEGURIDAD DE LA CUENTA ===== */
.pill--ok { background: rgba(47,191,113,0.14); color: #5fd697; }
.pill--warn { background: rgba(245,165,36,0.14); color: #ffc768; }
.account-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.account-grid .section-card + .section-card { margin-top: 0; }
@media (min-width: 1100px) { .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .account-grid__full { grid-column: 1 / -1; } }
.meter { display: block; height: 0.25rem; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--danger); transition: width 0.25s, background-color 0.25s; }
.meter span[data-level="mid"] { background: var(--warn); }
.meter span[data-level="high"] { background: var(--ok); }
.log-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.log-dot--bad { background: var(--danger); }
.steps-list { display: grid; gap: 1.125rem; padding-left: 1.25rem; list-style: decimal; color: var(--text-2); font-size: 0.9rem; }
.steps-list li::marker { color: var(--primary-2); font-weight: 700; }
.steps-list strong { color: var(--text); }
.secret-box { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.625rem 0 0.375rem; }
.secret-box code { padding: 0.5rem 0.75rem; font-size: 0.95rem; letter-spacing: 0.06em; word-break: break-all; user-select: all; }
.code-input { display: block; width: 100%; max-width: 13rem; height: 3rem; margin-top: 0.625rem; padding: 0 0.875rem; border-radius: 0.75rem; background: rgba(255,255,255,0.04); border: 1px solid var(--border-2); outline: none; font-family: ui-monospace, monospace; font-size: 1.375rem !important; letter-spacing: 0.3em; text-align: center; }
.field .code-input { max-width: none; margin-top: 0; }
.code-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,57,28,0.18); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.codes code { padding: 0.5rem; text-align: center; font-size: 0.95rem; letter-spacing: 0.04em; user-select: all; }
.auth__link { width: 100%; cursor: pointer; }
.auth__link + .auth__link { margin-top: 0.5rem; }
.link { color: var(--primary-2); text-decoration: underline; }
