/* ========================================================
   VISTAS DE CONTENIDO: Ofertas, Blog y Clasificación
   Capa sobre theme.css. Misma gramática visual en las tres:
   resumen en cifras → barra de herramientas → tarjetas o tabla.
   ======================================================== */

/* ── Resumen en cifras ─────────────────────────────── */
.cv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cv-stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 14px; }
.cv-stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bg-subtle); color: var(--text-secondary); }
.cv-stat-icon svg { width: 19px; height: 19px; }
.cv-stat-icon.green { background: var(--le-brand-green-subtle); color: var(--le-brand-green); }
.cv-stat-icon.amber { background: #fdf2d6; color: #8a5a00; }
.cv-stat-icon.red { background: var(--le-brand-red-subtle); color: var(--le-brand-red); }
.cv-stat-icon.blue { background: var(--le-accent-blue-subtle); color: var(--le-accent-blue); }
@media (prefers-color-scheme: dark) { .cv-stat-icon.amber { background: #33290e; color: #f5cf6b; } }
.cv-stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--text-primary); }
.cv-stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ── Barra de herramientas ─────────────────────────── */
.cv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.cv-search { position: relative; flex: 1 1 280px; max-width: 420px; min-width: 200px; }
.cv-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-muted); pointer-events: none; }
.cv-search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-primary); font-size: 14px; }
.cv-search input:focus { outline: none; border-color: var(--le-brand-green); box-shadow: var(--ring); }
.cv-search input::placeholder { color: var(--text-muted); }

.cv-segment { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-subtle); border: 1px solid var(--border-card); border-radius: 12px; }
.cv-segment button { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; }
.cv-segment button:hover { color: var(--text-primary); }
.cv-segment button.active { background: var(--bg-card); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.cv-segment .n { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-muted); }
.cv-segment button.active .n { background: var(--le-brand-green-subtle); color: var(--le-brand-green); }

.cv-spacer { flex: 1 1 0; }
.cv-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-primary); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.cv-btn svg { width: 16px; height: 16px; flex: none; }
.cv-btn:hover { background: var(--bg-subtle); border-color: var(--text-muted); }
.cv-btn.primary { background: var(--le-brand-green); border-color: transparent; color: #fff; }
@media (prefers-color-scheme: dark) { .cv-btn.primary { color: #08130a; } }
.cv-btn.primary:hover { background: var(--le-brand-green-light); }
.cv-btn.icon { width: 40px; padding: 0; }
.cv-btn:focus-visible, .cv-segment button:focus-visible, .cv-icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.cv-count { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0 0 14px; }

/* ── Tarjetas ──────────────────────────────────────── */
.cv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.cv-card { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 16px; overflow: hidden; transition: box-shadow .18s, transform .18s, border-color .18s; }
.cv-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.cv-media { position: relative; aspect-ratio: 16 / 10; background: var(--bg-subtle); overflow: hidden; }
.cv-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.cv-card:hover .cv-media img { transform: scale(1.04); }
.cv-media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0, 0, 0, .32), transparent 38%); }
.cv-ph { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255, 255, 255, .85); background: linear-gradient(135deg, var(--ph-a, #2f6b1d), var(--ph-b, #7bb04a)); }
.cv-ph svg { width: 44px; height: 44px; opacity: .9; }
.cv-ph.t1 { --ph-a: #2f6b1d; --ph-b: #7bb04a; }
.cv-ph.t2 { --ph-a: #c8321f; --ph-b: #f0845f; }
.cv-ph.t3 { --ph-a: #1f5aa8; --ph-b: #62a3e8; }
.cv-ph.t4 { --ph-a: #8a4fc0; --ph-b: #c59be8; }
.cv-ph.t5 { --ph-a: #b8741a; --ph-b: #efbb5c; }

.cv-pill { position: absolute; z-index: 1; top: 12px; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .94); color: #14201a; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.cv-pill.left { left: 12px; }
.cv-pill.right { right: 12px; }
.cv-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa7a0; }
.cv-pill.live .dot { background: #1f9d55; box-shadow: 0 0 0 3px rgba(31, 157, 85, .2); }
.cv-pill.soon { background: #fff1cf; color: #7a5200; }
.cv-pill.expired { background: #fde9e7; color: #93271e; }
.cv-pill.fine { background: rgba(255, 255, 255, .94); }
.cv-pill svg { width: 13px; height: 13px; }

.cv-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 14px; flex: 1; }
.cv-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cv-summary { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cv-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.cv-meta svg { width: 15px; height: 15px; flex: none; }
.cv-meta strong { color: var(--text-secondary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-meta .sep { opacity: .5; }
.cv-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 800; color: #fff; background: var(--le-brand-green); }

.cv-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; margin-top: auto; border-top: 1px solid var(--border-subtle); }
.cv-foot .cv-btn { flex: 1; height: 38px; font-size: 13px; }
.cv-icon-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.cv-icon-btn svg { width: 17px; height: 17px; }
.cv-icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--text-muted); }
.cv-icon-btn.danger:hover { color: var(--le-brand-red); border-color: var(--le-brand-red); background: var(--le-brand-red-subtle); }

/* ── Tabla ─────────────────────────────────────────── */
.cv-table-wrap { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 16px; }
.cv-table { width: 100%; border-collapse: collapse; }
.cv-table th { text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); background: var(--bg-subtle); border-bottom: 1px solid var(--border-card); white-space: nowrap; }
.cv-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; font-size: 13.5px; }
.cv-table tbody tr:last-child td { border-bottom: 0; }
.cv-table tbody tr:hover td { background: var(--bg-subtle); }
.cv-table .right { text-align: right; white-space: nowrap; }
.cv-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cv-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; flex: none; background: var(--bg-subtle); }
.cv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv-thumb .cv-ph svg { width: 22px; height: 22px; }
.cv-cell-title { font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.cv-cell-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.cv-clamp { max-width: 320px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cv-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--bg-subtle); color: var(--text-secondary); }
.cv-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa7a0; }
.cv-chip.live { background: var(--le-brand-green-subtle); color: var(--le-brand-green); }
.cv-chip.live .dot { background: var(--le-brand-green); }
.cv-chip.soon { background: #fff1cf; color: #7a5200; }
.cv-chip.expired { background: var(--le-brand-red-subtle); color: var(--le-brand-red); }
@media (prefers-color-scheme: dark) { .cv-chip.soon { background: #33290e; color: #f5cf6b; } }

/* ── Estado vacío ──────────────────────────────────── */
.cv-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 24px; background: var(--bg-card); border: 1px dashed var(--border-card); border-radius: 18px; }
.cv-empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--le-brand-green-subtle); color: var(--le-brand-green); }
.cv-empty-icon svg { width: 26px; height: 26px; }
.cv-empty h3 { margin: 6px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.cv-empty p { margin: 0 0 8px; max-width: 42ch; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }

/* ── Clasificación ─────────────────────────────────── */
.tax-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.tax-nav { position: sticky; top: 108px; display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 16px; }
.tax-nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 11px; background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.tax-nav button:hover { background: var(--bg-subtle); color: var(--text-primary); }
.tax-nav button.active { background: var(--le-brand-green-subtle); color: var(--le-brand-green); }
.tax-nav .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 17px; background: var(--bg-subtle); }
.tax-nav button.active .ico { background: var(--bg-card); }
.tax-nav .lbl { flex: 1; min-width: 0; line-height: 1.25; }
.tax-nav .n { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg-subtle); color: var(--text-muted); }
.tax-nav button.active .n { background: var(--bg-card); color: var(--le-brand-green); }

.tax-panel { min-width: 0; }
.tax-panel-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.tax-panel-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.tax-panel-head p { margin: 0; font-size: 13.5px; color: var(--text-secondary); max-width: 60ch; line-height: 1.5; }

.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.tax-item { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: 14px; transition: box-shadow .15s, border-color .15s; }
.tax-item:hover { box-shadow: var(--shadow-hover); }
.tax-tile { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; font-size: 22px; background: var(--bg-subtle); }
.tax-tile.ini { font-size: 18px; font-weight: 800; letter-spacing: -.02em; color: #fff; background: linear-gradient(135deg, var(--ph-a), var(--ph-b)); }
.tax-tile.ini.t1 { --ph-a: #2f6b1d; --ph-b: #6aa63f; }
.tax-tile.ini.t2 { --ph-a: #c8321f; --ph-b: #ee7b5a; }
.tax-tile.ini.t3 { --ph-a: #1f5aa8; --ph-b: #5b9be0; }
.tax-tile.ini.t4 { --ph-a: #7e45b3; --ph-b: #b98ae0; }
.tax-tile.ini.t5 { --ph-a: #b8741a; --ph-b: #e8b14f; }
.tax-main { flex: 1; min-width: 0; }
.tax-name { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.015em; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tax-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.tax-usage { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.tax-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--bg-subtle); overflow: hidden; }
.tax-bar span { display: block; height: 100%; border-radius: 999px; background: var(--le-brand-green); min-width: 3px; }
.tax-bar.zero span { background: var(--border-card); }
.tax-count { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.tax-tools { display: flex; flex-direction: column; gap: 6px; opacity: 0; transition: opacity .15s; }
.tax-item:hover .tax-tools, .tax-item:focus-within .tax-tools { opacity: 1; }
.tax-tools .cv-icon-btn { width: 32px; height: 32px; }
.tax-tools .cv-icon-btn svg { width: 15px; height: 15px; }
@media (hover: none) { .tax-tools { opacity: 1; } }

@media (max-width: 980px) {
  .tax-layout { grid-template-columns: 1fr; }
  .tax-nav { position: static; flex-direction: row; overflow-x: auto; padding: 6px; scrollbar-width: none; }
  .tax-nav button { width: auto; flex: none; padding: 8px 12px; }
  .tax-nav .ico { display: none; }
}
@media (max-width: 720px) {
  .cv-grid { grid-template-columns: 1fr; }
  .cv-search { max-width: none; flex-basis: 100%; }
  .cv-segment { overflow-x: auto; max-width: 100%; }
  .cv-table th:nth-child(2), .cv-table td:nth-child(2) { display: none; }
}
.cv-table .cv-actions { flex-wrap: nowrap; }

/* ========================================================
   FORMULARIOS DE EDICIÓN (paneles laterales y diálogos)
   Todos los campos ocupan el ancho de su columna y comparten altura, radio y foco.
   ======================================================== */
.drawer-panel { background: var(--bg-card); }
.drawer-header { align-items: center; justify-content: space-between; padding: 18px 28px; }
.drawer-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.drawer-body { padding: 24px 28px 32px; }
.drawer-body form { display: flex; flex-direction: column; gap: 18px; }
.drawer-footer { padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 0; }
.field-col { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: initial !important; }
.field-label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-primary); }
.field-col > .field-label { margin: 0; }
.field-input, .field-select, .field-textarea { display: block; width: 100%; box-sizing: border-box; min-height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-primary); font-size: 14px; line-height: 1.4; }
.field-textarea { padding: 11px 13px; min-height: 110px; resize: vertical; }
.field-select { appearance: none; padding-right: 36px; 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='%2387958c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field-input:focus, .field-select:focus, .field-textarea:focus { background: var(--bg-card); border-color: var(--le-brand-green); box-shadow: var(--ring); }
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-muted); }
.field-input[type="datetime-local"], .field-input[type="date"] { padding-right: 10px; }

/* Bloque de imagen: campo + botón de subida + vista previa */
#coupon-photo-preview, #article-photo-preview, #event-photo-preview { width: 100% !important; border-radius: 14px !important; border: 1px dashed var(--border-card) !important; background: var(--bg-subtle); overflow: hidden; }
#coupon-photo-preview img, #article-photo-preview img, #event-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.drawer-body .btn-card-edit { height: 34px; padding: 0 12px; font-size: 12.5px; }

/* Diálogo de clasificación */
dialog.q-modal h3 { letter-spacing: -.02em; }
dialog.q-modal .field-label { margin-bottom: 7px; }
.cv-segment button { white-space: nowrap; }
@media (max-width: 720px) {
  .cv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cv-stat { padding: 12px; gap: 10px; }
  .cv-stat-icon { width: 34px; height: 34px; }
  .cv-stat-value { font-size: 19px; }
  .cv-stat-label { font-size: 12px; }
  .cv-actions { width: 100%; }
  .cv-actions .cv-btn.primary { flex: 1; }
}
