/* ============================================================
   COMERCIOS DE PARANÁ · Sistema de diseño (base)
   Colores tomados del logo: azul río, verde parque, verde profundo, crema sol.
   ============================================================ */
:root {
  --blue: #008CCB;
  --blue-700: #006fa3;
  --blue-50: #e8f5fc;
  --green: #089854;
  --green-700: #067a44;
  --green-900: #016650;
  --green-50: #e6f6ee;
  --cream: #FFEFCB;
  --cream-50: #fff9ec;
  --ink: #10222b;
  --ink-2: #2b3f49;
  --muted: #5d6f78;
  --line: #e3eaee;
  --line-2: #d3dde3;
  --bg: #f5f8fa;
  --card: #ffffff;
  --wa: #1fa855;
  --wa-700: #168a44;
  --danger: #d6453d;
  --danger-50: #fdeceb;
  --warn: #c98a00;
  --warn-50: #fff6dd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 34, 43, .06), 0 1px 3px rgba(16, 34, 43, .04);
  --shadow: 0 4px 14px rgba(16, 34, 43, .07), 0 1px 3px rgba(16, 34, 43, .05);
  --shadow-lg: 0 18px 40px rgba(16, 34, 43, .14);
  --brand-grad: linear-gradient(135deg, #016650 0%, #089854 48%, #008CCB 100%);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.req { color: var(--danger); }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.ic-lg { width: 1.6em; height: 1.6em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(0, 140, 203, .45); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.right { margin-left: auto; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1;
  padding: .8em 1.2em; border-radius: 11px; border: 1.5px solid transparent;
  background: var(--blue); color: #fff; cursor: pointer; text-decoration: none !important;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease, border-color .15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.btn:hover { background: var(--blue-700); }
.btn:active { transform: translateY(1px); }
.btn-green { background: var(--green); } .btn-green:hover { background: var(--green-700); }
.btn-wa { background: var(--wa); } .btn-wa:hover { background: var(--wa-700); }
.btn-dark { background: var(--green-900); } .btn-dark:hover { background: #014d3c; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn-outline:hover { background: var(--bg); border-color: var(--blue); color: var(--blue-700); }
.btn-ghost { background: transparent; color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: rgba(16, 34, 43, .06); }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #b9352e; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #f0c4c1; box-shadow: none; }
.btn-danger-outline:hover { background: var(--danger-50); border-color: var(--danger); }
.btn-sm { font-size: .85rem; padding: .6em .9em; border-radius: 9px; }
.btn-lg { font-size: 1.05rem; padding: 1em 1.5em; border-radius: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--bg); border-color: var(--line-2); }

/* ---------- Tarjetas / etiquetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }
.chip, .badge {
  display: inline-flex; align-items: center; gap: .4em; font-size: .78rem; font-weight: 700; line-height: 1;
  padding: .4em .7em; border-radius: 999px; background: var(--blue-50); color: var(--blue-700); white-space: nowrap;
}
.badge-green { background: var(--green-50); color: var(--green-700); }
.badge-warn { background: var(--warn-50); color: #8a5d00; }
.badge-danger { background: var(--danger-50); color: var(--danger); }
.badge-gray { background: #eef2f4; color: var(--muted); }
.badge-sale { background: var(--danger); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--ink-2); }
.help { display: block; color: var(--muted); font-size: .82rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: .98rem; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line-2); border-radius: 10px; padding: .72em .9em; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
select { 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='%235d6f78' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8em center; padding-right: 2.4em; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 140, 203, .15); }
input[type=file] { font: inherit; font-size: .9rem; width: 100%; padding: .6em; border: 1.5px dashed var(--line-2); border-radius: 10px; background: var(--bg); }
.input-group { display: flex; align-items: stretch; }
.input-group > .addon { display: grid; place-items: center; padding: 0 .9em; background: var(--bg); border: 1.5px solid var(--line-2); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); font-weight: 700; }
.input-group > input { border-radius: 0 10px 10px 0; }
.input-group > input:first-child { border-radius: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; } }

.chips-check { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; padding: .45em .9em; border: 1.5px solid var(--line-2); border-radius: 999px; font-size: .88rem; font-weight: 600; cursor: pointer; background: #fff; user-select: none; }
.chip-check input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-check input:focus-visible + span { outline: 3px solid rgba(0, 140, 203, .45); outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); position: relative; transition: .2s; flex: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 21px; }
.switch input:focus-visible + span { outline: 3px solid rgba(0, 140, 203, .45); outline-offset: 2px; }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card > span { display: block; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fff; height: 100%; }
.radio-card strong { display: block; font-size: .95rem; }
.radio-card small { color: var(--muted); }
.radio-card input:checked + span { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(0, 140, 203, .15); }
.radio-card input:focus-visible + span { outline: 3px solid rgba(0, 140, 203, .45); outline-offset: 2px; }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font-size: .94rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert .ic { margin-top: 3px; }
.alert-success { background: var(--green-50); color: #0b5c37; border-color: #bfe6d1; }
.alert-error { background: var(--danger-50); color: #9c2b25; border-color: #f4c9c6; }
.alert-warn { background: var(--warn-50); color: #7a5300; border-color: #f2dc9c; }
.alert-info { background: var(--blue-50); color: #00577f; border-color: #bde0f2; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 16px; background: #fafcfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfd; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--bg); border: 1px solid var(--line); }
.thumb-ph { display: grid; place-items: center; color: var(--line-2); width: 48px; height: 48px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }

/* ---------- Paginación ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 28px 0 8px; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 700; text-decoration: none; }
.pagination a:hover { border-color: var(--blue); color: var(--blue-700); text-decoration: none; }
.pagination .current { background: var(--blue); border-color: var(--blue); color: #fff; }
.pagination .gap { border: 0; background: none; }

/* ---------- Estados vacíos ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--line-2); }
.empty h3 { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.flip { transform: scaleX(-1); }
