/* admin.css — catalog admin. Desktop-first polish, still usable at 375px.
 * No framework, no web fonts. Shares no rules with style.css (separate file). */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --surface-2: #ececee;
  --text: #17181a;
  --muted: #6b7280;
  --border: #e0e0e4;
  --accent: #2563eb;
  --primary: #17181a;
  --primary-ink: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;

  --ok-bg: #ecfdf5;
  --ok-ink: #065f46;
  --ok-border: #a7f3d0;
  --err-bg: #fef2f2;
  --err-ink: #991b1b;
  --err-border: #fecaca;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101113;
    --surface: #17181b;
    --surface-2: #212227;
    --text: #ececf0;
    --muted: #9aa0a6;
    --border: #2c2d33;
    --accent: #5b9dff;
    --primary: #ececf0;
    --primary-ink: #101113;
    --danger: #f87171;
    --ok: #22c55e;

    --ok-bg: #05271c;
    --ok-ink: #6ee7b7;
    --ok-border: #135e43;
    --err-bg: #2a1213;
    --err-ink: #fca5a5;
    --err-border: #7f1d1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .5);
  }
}

/* ------------------------------------------------------------------- reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--surface);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
}

button {
  font: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

/* -------------------------------------------------------------------- nav */
.admin-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.admin-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
}

.admin-nav a:hover {
  background: var(--surface-2);
}

.admin-nav .inline {
  margin: 0 0 0 auto;
}

.admin-nav .inline button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

/* ----------------------------------------------------------------- layout */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ------------------------------------------------------------------ flash */
.flash,
.error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  font-size: .95rem;
  border: 1px solid transparent;
}

.flash-ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: var(--ok-border);
}

.flash-err,
.error {
  background: var(--err-bg);
  color: var(--err-ink);
  border-color: var(--err-border);
}

/* Neutral "you still need to do this" notice. Uses only existing tokens, so it
   follows the dark-mode palette without new color literals. */
.flash-warn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

/* --------------------------------------------------------- forms (shared) */
label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 600;
  font-size: .9rem;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

button[type="submit"] {
  margin-top: 18px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}

fieldset {
  margin: 18px 0 0;
  padding: 12px 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: .9rem;
}

/* -------------------------------------------------- productos: toolbar */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-search-label {
  margin: 0;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.admin-search input {
  width: clamp(180px, 32vw, 340px);
  height: 40px;
  box-sizing: border-box;
  margin: 0;
}

.admin-search button,
.btn-nuevo {
  height: 40px;
  min-height: 0;
  margin: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  white-space: nowrap;
}

.admin-search button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-nuevo {
  border: 0;
  background: var(--primary);
  color: var(--primary-ink);
  text-decoration: none;
  font-weight: 700;
}

/* ------------------------------------------------------ list tables */
.admin-list {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-list .col-img { width: 68px; }
.admin-list .col-cat { width: 13%; }
.admin-list .col-precio { width: 100px; }
.admin-list .col-estado { width: 130px; }
.admin-list .col-acciones { width: 150px; }
/* col-nombre takes the rest */

.admin-list thead {
  background: var(--surface);
}

.admin-list th,
.admin-list td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-list th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.admin-list tbody tr:last-child td {
  border-bottom: none;
}

.admin-list .cell-nombre {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.admin-list .cell-precio {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: block;
}

.admin-thumb-placeholder {
  border: 1px dashed var(--border);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.admin-list td.admin-actions {
  padding-left: 8px;
  padding-right: 8px;
}

.cell-cond {
  display: block;
  margin-top: 6px;
  font-size: .72rem;
  color: var(--muted);
}

/* icon-only action buttons. Base rule is unscoped (works standalone, e.g. an
   <a> in a page header); the `.admin-actions` variant repeats it at higher
   specificity so it still beats the generic button[type=submit] rule when the
   icon is a <button> inside an actions cell. */
.btn-icon,
.admin-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.btn-icon svg,
.admin-actions .btn-icon svg { display: block; }

.btn-icon:hover,
.admin-actions .btn-icon:hover { background: var(--surface-2); }

.admin-actions .btn-icon-vender {
  border-color: var(--ok);
  color: var(--ok);
}

.admin-actions .btn-icon-delete {
  border-color: var(--danger);
  color: var(--danger);
}

.admin-actions .btn-icon-revertir {
  border-color: var(--border);
  color: var(--muted);
}

.inline {
  display: inline;
  margin: 0;
}

.btn-edit {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: .88rem;
}

.btn-delete {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  font-size: .88rem;
}

.badge-agotado,
.badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
}

.badge-agotado {
  background: rgba(220, 38, 38, .12);
  color: var(--danger);
}

.badge-ok {
  background: rgba(22, 163, 74, .14);
  color: var(--ok);
}

.empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------------------------- categorías rows */
.admin-cat-nueva,
.admin-config-form,
.admin-cat-rename {
  max-width: 640px;
}

.admin-cat-nueva {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-cat-nueva label {
  margin: 0;
  flex-basis: 100%;
}

.admin-cat-nueva input {
  flex: 1 1 200px;
}

.admin-cat-nueva button,
.admin-cat-rename button {
  margin-top: 0;
}

.admin-cat-rename {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-cat-rename input {
  width: auto;
  flex: 1 1 auto;
  min-width: 120px;
}

/* --------------------------------------------------- product form */
.admin-producto-form form {
  max-width: 680px;
}

#img-zone {
  margin-top: 18px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 130px;
  transition: border-color .12s ease, background .12s ease;
}

#img-zone:focus,
#img-zone:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

#img-zone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(37, 99, 235, .08);
}

#img-zone label {
  margin-top: 0;
}

#img-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

#img-previews:empty {
  display: none;
}

.img-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  touch-action: none; /* let a drag gesture reorder without scrolling the page */
  user-select: none;
}

.img-preview.dragging {
  opacity: .55;
  outline: 2px solid var(--accent);
}

.img-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.img-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(23, 24, 26, .7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}

.img-handle {
  position: absolute;
  bottom: 3px;
  left: 3px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(23, 24, 26, .55);
  color: #fff;
  font-size: .85rem;
  line-height: 1.3;
  cursor: grab;
  touch-action: none;
}

.img-preview.dragging .img-handle {
  cursor: grabbing;
}

.img-existentes .img-existente {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.img-existentes .img-existente:last-child {
  border-bottom: none;
}

.img-existente img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.img-existente label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.img-existente input[type="number"] {
  width: 72px;
}

.img-reorder-hint {
  margin: 0 0 6px;
  font-size: .82rem;
  color: var(--muted);
}

.img-drag {
  display: none;
  align-self: center;
  padding: 0 4px;
  color: var(--muted);
  font-size: 1.1rem;
  letter-spacing: 2px;
  cursor: grab;
}

/* drag mode: show the handle, let the whole row be grabbed, drop the number box */
.img-existentes.js-dnd .img-existente {
  cursor: grab;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--surface);
}

.img-existentes.js-dnd .img-drag {
  display: block;
}

.img-existentes.js-dnd .img-existente.dragging {
  opacity: .45;
  cursor: grabbing;
}

@media (pointer: fine) {
  .img-existentes.js-dnd .img-orden {
    display: none;
  }
}

/* --------------------------------------------------- login page */
.admin-login {
  max-width: 360px;
  margin: 8vh auto 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
}

.admin-login label {
  margin-top: 14px;
}

.admin-login button[type="submit"] {
  width: 100%;
}

.admin-login p {
  margin-bottom: 0;
}

/* --------------------------------------------------- modal (delete confirm) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .5);
}

.modal-dialog {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal-text {
  margin: 0 0 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
}

.modal-cancel {
  background: var(--surface);
  color: var(--text);
}

.modal-confirm {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* --------------------------------------------------- narrow screens */
@media (max-width: 560px) {
  .admin-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-search {
    width: 100%;
  }

  .btn-nuevo {
    justify-content: center;
  }
}

/* Product list: real table on wide screens, stacked cards on phones. */
@media (max-width: 720px) {
  .admin-list,
  .admin-list tbody,
  .admin-list tr,
  .admin-list td {
    display: block;
    width: auto;
  }

  .admin-list {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .admin-list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .admin-list tr {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
  }

  .admin-list td {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 4px 10px;
    padding: 5px 0;
    border: 0;
  }

  .admin-list td::before {
    content: attr(data-label);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    align-self: center;
  }

  .admin-list .cell-img {
    grid-template-columns: 1fr;
  }

  .admin-list .cell-img::before {
    display: none;
  }

  .admin-list .admin-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .admin-list td.admin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 0 2px;
    border-top: 1px solid var(--border);
  }

  .admin-list .admin-actions::before {
    display: none;
  }

  .admin-list .admin-actions .inline {
    display: inline-flex;
  }

  .admin-list .admin-actions .btn-icon {
    width: 44px;
    height: 44px;
  }

  .admin-list .cell-cond {
    grid-column: 2;
    margin-top: 0;
  }
}

/* ------------------------------------------------------------- estadísticas */
.admin-hint {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: .9rem;
  max-width: 60ch;
}

.stat-periodo {
  display: flex;
  gap: 6px;
  margin: 4px 0 20px;
}

.stat-periodo a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
}

.stat-periodo a.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card-hi {
  background: var(--bg);
  border-color: var(--primary);
}

.stat-k {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.stat-scope {
  text-transform: none;
  letter-spacing: 0;
}

.stat-v {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-slash {
  color: var(--muted);
  font-weight: 400;
}

.stat-sub {
  font-size: .78rem;
  color: var(--muted);
}

.stat-block {
  margin-bottom: 28px;
}

.stat-block h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}

.stat-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-bar-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 10px;
}

.stat-bar-label {
  font-size: .8rem;
  color: var(--muted);
  text-align: right;
}

.stat-bar-track {
  height: 20px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
}

.stat-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 5px;
  background: var(--accent);
}

.stat-bar-val {
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-bar-cant {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .72rem;
}

.stat-bars-total {
  margin: 12px 0 0;
  font-size: .85rem;
  color: var(--muted);
}

.stat-table th:not(:first-child),
.stat-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------- venta (admin list) */
.badge-vendido {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
}

tr.is-vendido {
  opacity: .72;
}

tr.is-vendido .cell-nombre {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.venta-info {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.venta-edit {
  margin-top: 4px;
}

.venta-edit > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: .78rem;
}

.venta-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.venta-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .72rem;
  color: var(--muted);
}

.venta-edit-form input {
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  max-width: 120px;
}

.venta-edit-form button {
  margin: 0;
  min-height: 32px;
  padding: 0 12px;
}

.btn-vender,
.btn-revertir {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .84rem;
  text-decoration: none;
}

.btn-vender {
  border: 1px solid var(--ok);
  background: rgba(22, 163, 74, .12);
  color: var(--ok);
}

.btn-revertir {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-cancelar {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-left: 8px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

/* -------------------------------------------------------------- ventas */
.badge-tipo {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: capitalize;
}
.badge-tipo-contado { background: rgba(22, 163, 74, .16); color: var(--ok); }
.badge-tipo-fiado { background: rgba(234, 179, 8, .18); color: #a16207; }
@media (prefers-color-scheme: dark) {
  .badge-tipo-fiado { color: #fde047; }
}

.venta-tipo,
.venta-items {
  margin: 18px 0 0;
}
.venta-tipo .checkbox-row { display: inline-flex; margin-right: 18px; }

.venta-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.venta-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.venta-item-row select { flex: 1 1 auto; min-width: 0; }
.venta-item-row input { width: 140px; flex: 0 0 auto; }
.venta-item-del {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}
.venta-item-add {
  margin: 0 0 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.venta-total-line,
.venta-debe-line {
  margin: 8px 0 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.venta-adelanto-wrap { margin-top: 16px; }
.venta-adelanto-wrap[hidden] { display: none; }

.venta-totales {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.venta-totales > div {
  flex: 1 1 140px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.venta-totales span {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.venta-totales strong {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}
.venta-totales .venta-saldo-debe { border-color: var(--danger); }
.venta-totales .venta-saldo-debe strong { color: var(--danger); }

.venta-meta { margin: 4px 0 0; color: var(--muted); }
.venta-nota { margin: 8px 0 0; white-space: pre-wrap; }

.venta-abono-form {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.venta-abono-form h3 { margin: 0 0 10px; font-size: 1rem; }

.venta-eliminar { margin-top: 24px; }

.admin-venta-detalle h2 { font-size: 1.05rem; margin: 24px 0 10px; }

.venta-editar-btn {
  margin-left: 10px;
  vertical-align: middle;
}

.venta-item-row-fixed {
  display: flex;
  align-items: center;
  gap: 10px;
}
.venta-item-row-fixed .venta-item-nombre {
  flex: 1 1 auto;
  font-weight: 600;
}
.venta-item-row-fixed input { width: 140px; flex: 0 0 auto; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: .88rem;
}
.btn-back:hover { background: var(--surface-2); }

.venta-item-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

/* --- Panel de plataforma (solo dueño) --- */
.admin-plataforma .muted {
  color: var(--muted, #6b7280);
  font-size: 0.85em;
}
.admin-plataforma .plataforma-limites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  margin-top: 6px;
}
.admin-plataforma .plataforma-limites label {
  display: flex;
  flex-direction: column;
  font-size: 0.8em;
  gap: 2px;
}
.admin-plataforma .plataforma-limites input {
  width: 6rem;
}
.admin-plataforma .admin-actions form.inline {
  margin: 0 4px 4px 0;
}
