/* ===== Panel administrativo ===== */
body.admin { background: var(--gray-50); }
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar { background: var(--navy); color: var(--white); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1rem; text-decoration: none; color: var(--white); font-weight: 700; line-height: 1.2; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.sidebar-logo { width: 44px; height: 44px; object-fit: contain; background: var(--white); border-radius: 50%; padding: 3px; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; padding: .75rem; flex: 1; overflow-y: auto; }
.sidebar nav a { color: #d7e2f4; text-decoration: none; padding: .6rem .8rem; border-radius: 8px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .1); color: var(--white); }
.sidebar nav a.active { background: var(--blue); color: var(--white); font-weight: 600; }
.sidebar-foot { padding: 1rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .875rem; }
.sidebar-foot a { color: var(--blue-soft); }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--white); border-bottom: 1px solid var(--gray-300); display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; position: sticky; top: 0; z-index: 20; }
.topbar-title { margin: 0; font-size: 1.2rem; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.user-chip { display: flex; flex-direction: column; text-align: right; text-decoration: none; line-height: 1.2; color: var(--navy); font-weight: 600; font-size: .9rem; }
.user-chip small { color: var(--gray-600); font-weight: 400; }
.icon-btn { display: none; background: var(--white); border: 1px solid var(--gray-300); border-radius: 8px; font-size: 1.3rem; line-height: 1; padding: .35rem .65rem; cursor: pointer; color: var(--navy); }
.admin-content { padding: 1.5rem 1.25rem 3rem; max-width: 1100px; width: 100%; }

.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-header .lead { margin: 0; font-size: 1rem; }
.section-gap { margin-top: 2rem; }

/* Dashboard */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.5rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; background: var(--white); border: 1px solid var(--gray-300); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.stat:hover { border-left-color: var(--navy); }
.stat-n { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-weight: 600; }
.stat small { color: var(--gray-600); }
.two-col-admin { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }

/* Tablas */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; background: var(--gray-50); color: var(--navy); padding: .7rem 1rem; border-bottom: 1px solid var(--gray-300); white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.actions-col { text-align: right; }
.row-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }

/* Galería admin */
.photo-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.photo-item { padding: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.photo-item img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: 6px; }
.photo-item.is-hidden img { opacity: .4; }
.photo-item .row-actions { justify-content: flex-start; }
.form.compact { display: grid; gap: .4rem; }
.form.compact input { padding: .35rem .55rem; font-size: .9rem; }

/* Login / error */
body.auth { background: var(--gray-50); min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { background: var(--white); border: 1px solid var(--gray-300); border-top: 4px solid var(--navy); border-radius: var(--radius); padding: 2rem; width: min(430px, 100%); box-shadow: var(--shadow); }
.auth-card.wide { width: min(680px, 100%); }
.auth-logo { width: 96px; height: 96px; object-fit: contain; margin: 0 auto 1rem; }
.auth-card h1 { text-align: center; font-size: 1.5rem; }
.auth-card > p.muted { text-align: center; }
.auth-back { text-align: center; margin: 1.25rem 0 0; font-size: .9rem; }
.steps { padding-left: 1.2rem; }
.steps li { margin-bottom: 1rem; }

/* Adaptable: menú lateral deslizable en tablet y móvil */
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: none; box-shadow: 6px 0 24px rgba(0, 0, 0, .25); }
    .icon-btn { display: block; }
    .two-col-admin { grid-template-columns: 1fr; }
    .user-chip { display: none; }
}
@media (max-width: 640px) {
    .admin-content { padding: 1rem .75rem 2.5rem; }
    /* Tablas en formato de tarjeta */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: .6rem 1rem; border-bottom: 1px solid var(--gray-300); }
    .table td { border: 0; padding: .25rem 0; display: flex; gap: .75rem; justify-content: space-between; }
    .table td::before { content: attr(data-label); font-weight: 600; color: var(--gray-600); flex: none; }
    .table td[data-label="Acciones"] { display: block; padding-top: .5rem; }
    .table td[data-label="Acciones"]::before { display: none; }
    .row-actions { justify-content: flex-start; }
}
