:root {
  --ink: #16261d;
  --muted: #5f7568;
  --line: #dde8e0;
  --surface: var(--bodega-surface, #ffffff);
  --surface-strong: color-mix(in srgb, var(--brand-primary, #0e7a6d) 5%, #ffffff);
  --bg: var(--bodega-bg, #eef3ef);
  --gold: var(--brand-primary, #0e7a6d);
  --gold-soft: var(--brand-secondary, #2f8fd1);
  --wine: #e8a13c;
  --blue: #1479ff;
  --success: #12a758;
  --danger: #c23b3b;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(15, 35, 25, 0.06);
  --shadow-sm: 0 6px 18px rgba(15, 35, 25, 0.07);
  --shadow: 0 18px 42px rgba(11, 110, 58, 0.10);
  --shadow-lg: 0 28px 64px rgba(11, 110, 58, 0.16);
  --shadow-strong: 0 32px 90px rgba(11, 110, 58, 0.22);
}

* {
  box-sizing: border-box;
}

.public-demo-banner {
  position: sticky;
  top: 0;
  z-index: 999;
  padding: 8px 16px;
  text-align: center;
  color: #14110a;
  background: linear-gradient(90deg, #ffd166, #ffb703);
  font-size: 0.8rem;
  font-weight: 700;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px 1fr;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 105% -12%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 60%),
    var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

body.locked {
  grid-template-columns: 1fr;
}

body.locked .sidebar,
body.locked .app-shell {
  display: none;
}

body:not(.locked) .login-screen {
  display: none;
}

.login-screen {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(720px 420px at 12% 8%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 60%),
    radial-gradient(640px 420px at 88% 92%, color-mix(in srgb, var(--gold-soft) 14%, transparent), transparent 60%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 14px;
  padding: 36px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
}

.brand-badge-lg {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  border-radius: 50%;
  font-size: 1.9rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.brand-badge {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  border-radius: 11px;
  font-weight: 800;
  box-shadow: var(--shadow-xs);
}

.login-brand-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  object-fit: contain;
}

.login-heading strong {
  display: block;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.login-heading span {
  color: var(--muted);
  font-size: 0.85rem;
}

.login-card label {
  text-align: left;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.login-hint {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
}

.demo-access-note {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid rgba(14, 122, 109, 0.28);
  border-radius: 14px;
  background: rgba(14, 122, 109, 0.08);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.35;
}

.demo-access-note strong {
  color: var(--gold);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-access-note small {
  color: var(--muted);
  font-size: 0.76rem;
}

.sidebar {
  min-height: 100vh;
  padding: 26px 20px 22px;
  color: var(--ink);
  background: linear-gradient(185deg, var(--surface) 0%, var(--surface-strong) 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand strong, .brand span {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-tabs {
  display: grid;
  gap: 4px;
}

.nav-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  color: var(--ink);
  background: transparent;
  min-height: 44px;
  padding: 0 14px;
  text-align: left;
  border-radius: var(--radius-sm);
  font-size: 0.89rem;
  font-weight: 650;
  position: relative;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.nav-tab:hover {
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  box-shadow: var(--shadow-sm);
}

.nav-tab.active::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: var(--radius-pill, 999px);
  background: var(--gold);
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-user strong {
  display: block;
  font-size: 0.9rem;
}

.app-shell {
  min-width: 0;
  padding: 30px 38px;
}

.topbar, .section-toolbar, .panel-header, .modal-header, .top-actions, .toolbar-controls, .modal-actions {
  display: flex;
  align-items: center;
}

.topbar, .section-toolbar, .panel-header, .modal-header {
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.3rem, 1.6vw, 1.6rem);
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-actions, .toolbar-controls, .modal-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button, .ghost-button, .icon-button {
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  box-shadow: var(--shadow-sm);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.ghost-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.table-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.compact-action {
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.76rem;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: var(--surface-strong);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric, .panel, .panel-table {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}

.metric {
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--gold-soft));
}

.metric:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric span {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.metric.warning::before {
  background: linear-gradient(180deg, var(--danger), var(--wine));
}

.metric.warning strong {
  color: var(--danger);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.panel h2 {
  margin-top: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-fade-in 220ms ease;
}

@keyframes view-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-table .table-wrap,
.panel-table.table-wrap {
  border: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.8rem;
}

th {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-strong);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: var(--surface-strong);
}

.muted {
  color: var(--muted);
}

.worker-inactive {
  opacity: 0.5;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.settings-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-inline-form {
  margin-bottom: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="color"] {
  padding: 4px;
  height: 42px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 16%, transparent);
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 650;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.brand-preview-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.brand-preview-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.palette-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
}

.palette-presets button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease;
}

.palette-presets button:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.date-control {
  width: 170px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.modal {
  width: min(720px, calc(100vw - 24px));
  border: 0;
  padding: 0;
  background: transparent;
}

.small-modal {
  width: min(480px, calc(100vw - 24px));
}

.modal::backdrop {
  background: rgba(16, 34, 24, 0.55);
  backdrop-filter: blur(2px);
}

.modal form, .modal-card {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  transform: translateY(120%);
  transition: transform 200ms ease;
  z-index: 20;
}

.toast.visible {
  transform: translateY(0);
}

/* ---- Punto de venta ---- */

.pos-shortcuts-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pos-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 650;
}

.pos-shortcut kbd, .pos-shortcut-reminder kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink);
}

.pos-shortcut-charge kbd {
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  border-color: transparent;
}

.pos-focus-hint {
  margin: -6px 0 0;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 650;
}

.pos-shortcut-reminder {
  margin: 4px 0 0;
  font-size: 0.76rem;
  text-align: center;
}

.pos-layout {
  display: grid;
  gap: 18px;
}

.pos-search-bar {
  display: grid;
  gap: 8px;
}

.pos-search-results {
  display: grid;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.pos-search-result {
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  transition: background 120ms ease, border-color 120ms ease;
}

.pos-search-result:hover {
  background: var(--surface-strong);
}

.pos-search-result-focused {
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border-color: var(--gold);
}

.pos-search-result-name {
  font-weight: 650;
}

.pos-search-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.pos-search-result-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.pos-search-result-price {
  font-weight: 750;
  color: var(--ink);
  font-size: 0.84rem;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
}

.pos-product {
  display: grid;
  gap: 3px;
  padding: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 0.86rem;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.pos-product:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.pos-product-out {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.pos-product-price {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.88rem;
}

.pos-product-stock {
  font-size: 0.7rem;
  color: var(--muted);
}

.pos-product-qty-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #fff;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.7rem;
  font-weight: 800;
}

.pos-qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-cart-row-error {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* ---- Boleta / ticket de venta ---- */

.ticket-card {
  position: sticky;
  top: 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gold);
}

.ticket-head {
  padding: 16px 20px 12px;
  border-bottom: 1px dashed var(--line);
}

.ticket-head strong {
  display: block;
  font-size: 1rem;
}

.ticket-head span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.ticket-body {
  padding: 4px 20px;
  max-height: 30vh;
  overflow-y: auto;
}

.ticket-table {
  width: 100%;
  min-width: 0;
}

.ticket-table td {
  border-bottom: 1px dashed var(--line);
  padding: 9px 0;
  font-size: 0.82rem;
  vertical-align: top;
}

.ticket-table tr:last-child td {
  border-bottom: none;
}

.ticket-item-name {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.ticket-item-meta {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

.ticket-item-amount {
  text-align: right;
  white-space: nowrap;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.ticket-empty {
  text-align: center;
  padding: 22px 0 !important;
  color: var(--muted) !important;
  border-bottom: none !important;
}

.ticket-foot {
  padding: 14px 20px 20px;
  border-top: 1px dashed var(--line);
}

.ticket-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.ticket-total {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gold);
}

.pos-method-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.method-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.76rem;
  font-weight: 700;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.method-chip em {
  opacity: 0.6;
  font-style: normal;
}

.method-chip:hover {
  border-color: var(--gold);
}

.method-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  border-color: transparent;
}

.pos-fiado-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.fiado-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.fiado-check input {
  width: auto;
}

.pos-fiado-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pos-charge-button {
  width: 100%;
  min-height: 46px;
}

.ticket-tear {
  height: 12px;
  background:
    linear-gradient(-45deg, var(--bg) 6px, transparent 0) 0 0 / 12px 12px repeat-x,
    linear-gradient(45deg, var(--bg) 6px, transparent 0) 0 0 / 12px 12px repeat-x;
}

.pos-vuelto-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  font-size: 1rem;
}

.pos-vuelto-result strong {
  color: var(--gold);
  font-size: 1.35rem;
}

#vueltoForm {
  display: grid;
  gap: 12px;
}

@media (max-width: 860px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 10px;
  }
  .app-shell, .sidebar {
    padding: 12px 14px;
  }
  .brand {
    padding-bottom: 10px;
  }
  .nav-tabs {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-tab {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
    padding: 0 12px;
  }
  .nav-tab span {
    display: none;
  }
  .nav-icon {
    width: 20px;
    height: 20px;
  }
  .sidebar-user {
    padding-top: 10px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .nav-tab.active::before {
    display: none;
  }
}
