* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; background: #f4f4f7; color: #333; }
.sidebar { position: fixed; top: 0; left: 0; width: 220px; height: 100vh; background: #2D3453; padding: 24px 0; }
.sidebar-logo { color: #C9972A; font-size: 24px; text-align: center; font-family: Georgia, serif; margin-bottom: 4px; }
.sidebar-brand { color: rgba(255,255,255,0.5); font-size: 9px; text-align: center; letter-spacing: 2px; margin-bottom: 32px; }
.sidebar a { display: block; padding: 10px 24px; color: rgba(255,255,255,0.7); text-decoration: none; font-size: 14px; }
.sidebar a:hover, .sidebar a.active { color: #fff; background: rgba(255,255,255,0.1); }
.sidebar-logo-img { max-height: 40px; max-width: 160px; padding: 0 16px; display: block; margin: 0 auto; }
.sidebar-logout { position: absolute; bottom: 24px; left: 0; right: 0; }
.main { margin-left: 220px; padding: 32px; }
h1 { font-size: 22px; color: #2D3453; margin-bottom: 24px; }
h2 { font-size: 15px; color: #2D3453; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: #fff; border-radius: 8px; padding: 16px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,0.08); border-top: 3px solid #2D3453; }
.stat-n { font-size: 28px; font-weight: bold; color: #2D3453; }
.stat-l { font-size: 11px; color: #888; margin-top: 4px; }
.stat--positive { border-top-color: #1b5e20; }
.stat--positive .stat-n { color: #1b5e20; }
.stat--warning { border-top-color: #8a6200; }
.stat--warning .stat-n { color: #8a6200; }
.stat--natural { border-top-color: #1E4032; }
.stat--natural .stat-n { color: #1E4032; }
.stat--accent { border-top-color: #C9972A; }
.stat--accent .stat-n { color: #C9972A; }
.stat--danger { border-top-color: #c00; }
.stat--danger .stat-n { color: #c00; }
.stat--info { border-top-color: #0077cc; }
.stat--info .stat-n { color: #0077cc; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.panel { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px; border-bottom: 2px solid #eee; color: #888; font-size: 11px; text-transform: uppercase; }
td { padding: 8px; border-bottom: 1px solid #f0f0f0; }
tr:last-child td { border-bottom: none; }
a { color: #2D3453; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.badge-club    { background: #e8eaf6; color: #2D3453; }
.badge-premium { background: #fdf3e3; color: #8a6200; }
.badge-natural { background: #e8f5e9; color: #1E4032; }
.status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.status-active        { background: #e8f5e9; color: #1b5e20; }
.status-expired       { background: #fce4ec; color: #880e4f; }
.status-pending_expiry { background: #fff8e1; color: #f57f17; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 8px; }
.search-form { display: flex; gap: 8px; flex: 1; }
.search-form input, .search-form select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.search-form input { flex: 1; }
.search-form button { padding: 8px 16px; background: #2D3453; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-primary { display: inline-block; padding: 10px 20px; background: #2D3453; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; text-decoration: none; }
.btn-sm { display: inline-block; padding: 5px 12px; background: #f0f0f0; color: #333; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; text-decoration: none; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 13px; color: #888; }
.badge-alert { display: inline-block; background: #c00; color: #fff; border-radius: 10px; font-size: 10px; font-weight: bold; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.flex-gap-8 { display: flex; gap: 8px; }
.input-compact { width: 100%; padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; }
.alert-success { background: #e8f5e9; color: #1b5e20; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert-error { background: #fce4ec; color: #c00; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.mini-th { text-align: left; color: #888; padding: 4px 0; border-bottom: 1px solid #eee; }
.mini-th--right { text-align: right; color: #888; padding: 4px 0; border-bottom: 1px solid #eee; }
.btn-sm-active { background: #2D3453; color: #fff; }
.flex-gap-4 { display: flex; gap: 4px; }
.fs-11 { font-size: 11px; }
.d-inline { display: inline; }
.ta-center { text-align: center; }
.th-link { color: #888; text-decoration: none; }
.tag-alert { background: #fce4ec; color: #c00; font-size: 10px; padding: 1px 5px; border-radius: 3px; font-weight: bold; }
.text-warning-soft { color: #e57373; font-size: 11px; }
.wallet-yes { color: #1b5e20; font-size: 12px; font-weight: bold; }
.wallet-no { color: #ccc; font-size: 12px; }
.expiry { font-weight: bold; font-size: 12px; }
.expiry-overdue, .expiry-today { color: #c00; }
.expiry-soon { color: #e65100; }
.expiry-month { color: #f57f17; }
.expiry-ok { color: #1b5e20; }
.btn-primary--dark { background: #1E4032; }
.btn-primary--accent { background: #C9972A; }
.panel--narrow { max-width: 500px; }
.max-w-200 { max-width: 200px; }
.alert-blocked { background: #fce4ec; border: 1px solid #e57373; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.alert-blocked-icon { font-size: 20px; }
.alert-blocked-title { color: #c00; }
.alert-blocked-desc { font-size: 12px; color: #888; margin-top: 2px; }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 120px; padding-top: 16px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar-pair { width: 100%; display: flex; gap: 3px; align-items: flex-end; height: 80px; }
.chart-bar { flex: 1; border-radius: 3px 3px 0 0; height: var(--h, 0%); min-height: 2px; }
.chart-bar--empty { min-height: 0; }
.chart-bar--altas { background: #1b5e20; }
.chart-bar--bajas { background: #c00; }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 11px; color: #666; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.legend-swatch--altas { background: #1b5e20; }
.legend-swatch--bajas { background: #c00; }
.province-row { margin-bottom: 14px; }
.province-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.text-muted-13 { font-size: 13px; color: #666; }
.progress-track { background: #f0f0f0; border-radius: 6px; height: 10px; overflow: hidden; margin-bottom: 4px; }
.progress-fill { height: 100%; width: var(--w, 0%); background: linear-gradient(90deg,#2D3453,#C9972A); border-radius: 6px; }
.province-breakdown { font-size: 11px; color: #888; }
.mr-12 { margin-right: 12px; }
.bg-highlight-today { background: #fff0f0; }
.bg-highlight-soon { background: #fff8e1; }
.text-danger-bold-11 { color: #c00; font-size: 11px; font-weight: bold; }
.text-warning-bold-11 { color: #e65100; font-size: 11px; font-weight: bold; }
.text-warning-11 { color: #e65100; font-size: 11px; }
.fs-13 { font-size: 13px; }
.d-block { display: block; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.flex-gap-8-wrap { display: flex; gap: 8px; flex-wrap: wrap; }
.flex-gap-6 { display: flex; gap: 6px; }
.preview-type-label { font-size: 11px; color: #888; display: block; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.input-number-sm { width: 70px; padding: 4px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; text-align: center; }
.text-muted-12 { font-size: 12px; color: #666; }
.section-divider { margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee; }
/* TOGGLE SWITCHES (página Sistema) */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ddd; border-radius: 24px; transition: .3s; cursor: pointer; }
.toggle-slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: #2D3453; }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }
.config-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f0f0f0; gap: 16px; }
.config-row:last-child { border-bottom: none; }
.config-label { font-weight: bold; font-size: 13px; margin-bottom: 2px; }
.config-desc { font-size: 12px; color: #888; }
.config-sub { padding: 8px 0 8px 24px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; background: #fafafa; margin: 0 -20px; padding-left: 44px; padding-right: 20px; }
.topbar { position: fixed; top: 0; left: 220px; right: 0; height: 48px; background: #fff; border-bottom: 1px solid #eee; display: flex; align-items: center; padding: 0 24px; z-index: 50; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.topbar-search { display: flex; gap: 8px; flex: 1; max-width: 400px; }
.topbar-search input { flex: 1; padding: 7px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.topbar-search button { padding: 7px 14px; background: #2D3453; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.main { margin-left: 220px; padding: 32px; padding-top: 72px; }

/* HAMBURGER */
.hamburger { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: #2D3453; border: none; border-radius: 6px; padding: 8px 10px; cursor: pointer; flex-direction: column; gap: 5px; }
.hamburger span { display: block; width: 20px; height: 2px; background: #fff; border-radius: 2px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99; }

@media (max-width: 1024px) {
  .hamburger { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 100; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .topbar { left: 0; padding-left: 56px; }
  .main { margin-left: 0; padding: 24px; padding-top: 72px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 660px) {
  .main { padding: 16px; padding-top: 72px; }
  h1 { font-size: 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-n { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form { flex-direction: column; }
  table { font-size: 12px; }
  th, td { padding: 6px 4px; }
  .btn-primary { text-align: center; }
}

/* LOGIN (página independiente, sin sidebar) */
body.login-page { background: #2D3453; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 12px; padding: 40px; width: 360px; }
.login-logo { color: #C9972A; font-size: 32px; text-align: center; font-family: Georgia, serif; margin-bottom: 4px; }
.login-brand { color: #2D3453; font-size: 11px; text-align: center; letter-spacing: 3px; margin-bottom: 32px; }
.login-box label { display: block; font-size: 12px; color: #666; margin-bottom: 6px; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.login-box button { width: 100%; padding: 12px; background: #2D3453; color: #fff; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; }
.login-error { color: #c00; font-size: 13px; margin-bottom: 16px; text-align: center; }
.login-logo-img { max-height: 50px; max-width: 160px; }
.fs-12 { font-size: 12px; }
.mt-12 { margin-top: 12px; }
.nowrap { white-space: nowrap; }
.logs-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.log-row--success { background: #e8f5e9; }
.log-row--error { background: #fce4ec; }
.log-row--info { background: #e3f2fd; }
.log-row--warning { background: #fff8e1; }
.log-icon { font-size: 14px; }
.log-meta { font-size: 11px; color: #888; }
.log-detail-cell { font-size: 11px; color: #aaa; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-summary { font-size: 12px; color: #888; margin-left: 12px; }

/* ===== Utilidades atómicas (colores/tamaños/espaciado reutilizados en Detalle de socio, Config tarjetas, Vinos) ===== */
.c-666 { color: #666; }
.c-888 { color: #888; }
.c-aaa { color: #aaa; }
.c-c00 { color: #c00; }
.c-1b5e20 { color: #1b5e20; }
.c-2D3453 { color: #2D3453; }
.c-C9972A { color: #C9972A; }
.c-8a6d00 { color: #8a6d00; }
.c-fff { color: #fff; }
.fs-10 { font-size: 10px; }
.fs-14 { font-size: 14px; }
.fs-18 { font-size: 18px; }
.fs-22 { font-size: 22px; }
.fs-42 { font-size: 42px; }
.fw-bold { font-weight: bold; }
.fw-500 { font-weight: 500; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-none { display: none; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mt-2 { margin-top: 2px; }
.mt-8 { margin-top: 8px; }
.mr-10 { margin-right: 10px; }
.m-0 { margin: 0; }
.ta-left { text-align: left; }
.ta-right { text-align: right; }
.text-decoration-none { text-decoration: none; }
.br-6 { border-radius: 6px; }
.br-10 { border-radius: 10px; }
.br-12 { border-radius: 12px; }
.br-circle { border-radius: 50%; }
.cursor-pointer { cursor: pointer; }
.w-full { width: 100%; }

/* Detalle de socio */
.alert-warning { background: #fff8e1; color: #8a6d00; padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.back-link { font-size: 13px; color: #888; text-decoration: none; display: inline-block; margin-bottom: 16px; }
.member-header { margin-bottom: 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: bold; flex-shrink: 0; }
.avatar--club { background: #2D3453; }
.avatar--premium { background: #8a6200; }
.avatar--natural { background: #1E4032; }
.member-info { flex: 1; min-width: 200px; }
.member-name { margin: 0 0 4px; font-size: 18px; }
.member-sub { margin: 0; color: #666; font-size: 13px; }
.member-badges { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge-lg { font-size: 12px; }
.badge-xl { font-size: 13px; padding: 6px 12px; }
.pill-info { font-size: 12px; background: #eef1f7; color: #2D3453; padding: 2px 8px; border-radius: 10px; }
.member-expiry { font-size: 12px; }
.member-expiry--overdue { color: #c00; }
.member-expiry--soon { color: #e65100; }
.member-expiry--ok { color: #666; }
.tag-alert-pill { background: #fce4ec; color: #c00; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: bold; }
.member-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm--danger { background: #fce4ec; color: #c00; }
.btn-sm--success { background: #e8f5e9; color: #1b5e20; }
.input-invalid { border-color: #e57373; }
.textarea-full { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; resize: vertical; }
.panel--vermut { margin-top: 16px; border-left: 4px solid #C9972A; }
.panel--entregas { margin-bottom: 16px; border-left: 4px solid #2D3453; }
.text-meta { font-size: 12px; color: #888; margin: 0 0 12px; }
.points-total { text-align: center; padding: 8px 0 16px; }
.points-n { font-size: 42px; font-weight: bold; color: #C9972A; }
.points-l { font-size: 11px; color: #888; margin-bottom: 8px; }
.entrega-form-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.entrega-field { flex: 1; min-width: 100px; }
.entrega-field--year { flex: 1; min-width: 80px; }
.select-compact { width: 100%; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.field-label-sm { display: block; font-size: 11px; color: #666; margin-bottom: 4px; }
.btn-primary-sm { padding: 8px 14px; font-size: 13px; white-space: nowrap; }
.text-empty { font-size: 12px; color: #aaa; }
.link-btn { font-size: 11px; color: #2D3453; background: none; border: none; cursor: pointer; margin-right: 10px; }
.link-btn--danger { font-size: 11px; color: #c00; background: none; border: none; cursor: pointer; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 12px; padding: 28px; width: 360px; max-width: 90vw; }
.modal-title { margin-bottom: 16px; }
.modal-label { font-size: 14px; color: #2D3453; font-weight: bold; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.btn-cancel { padding: 8px 16px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.event-icon { font-size: 13px; }
.event-label { font-size: 12px; }
.event-detail { font-size: 11px; color: #aaa; margin-top: 2px; }
.event-meta { color: #888; font-size: 11px; }
.mini-td { padding: 4px 0; }
.lote-expiry--mid { color: #e65100; }
.lote-expiry--ok { color: #555; }

/* Configuración de tarjetas */
.upload-row { display: flex; gap: 16px; align-items: center; }
.logo-preview { max-height: 50px; max-width: 160px; background: #2D3453; padding: 8px; border-radius: 6px; }
.favicon-preview { width: 32px; height: 32px; }
.file-input-flex { flex: 1; font-size: 12px; }
.form-grid-2-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-picker-row { display: flex; gap: 8px; align-items: center; }
.color-swatch-input { width: 50px; height: 36px; }
.color-hex-input { width: 100px; }
.logo-chip { background: #1a1a1a; padding: 6px; border-radius: 4px; margin-bottom: 8px; display: inline-block; }
.logo-chip-img { height: 30px; display: block; }
.upload-empty { font-size: 11px; color: #aaa; margin-bottom: 6px; }
.strip-preview { width: 100%; height: 60px; object-fit: cover; border-radius: 4px; }
.thumb-preview { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; }

/* Vinos del club */
.mb-20 { margin-bottom: 20px; }
.search-input-wide { padding: 6px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; min-width: 220px; }
.link-info { font-size: 11px; color: #185FA5; }
.text-empty-light { color: #bbb; font-size: 11px; }
.text-empty-14 { color: #888; font-size: 14px; }
.tier-badge { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.tier-badge--club { background: #2D3453; color: #C9972A; }
.tier-badge--premium { background: #D4BFA0; color: #2D3453; }
.tier-badge--natural { background: #1E4032; color: #C9972A; }
.link-edit { font-size: 12px; color: #2D3453; margin-right: 8px; }
.link-delete { font-size: 12px; color: #c00; background: none; border: none; cursor: pointer; padding: 0; }
.stats--4col { grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; }
.stat-n--sm { font-size: 16px; padding-top: 4px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.form-wide { max-width: 680px; }
.back-link-muted { font-size: 13px; color: #666; display: inline-block; margin-bottom: 16px; }
.field-label-xs { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.col-span-full { grid-column: 1/-1; }
.btn-upload { padding: 8px 16px; font-size: 13px; }
.btn-uploaded { background: #1b5e20; }
.textarea-wine { width: 100%; min-height: 80px; padding: 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.btn-cancel-link { padding: 9px 16px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; color: #666; text-decoration: none; }

