:root {
  --ink: #211916;
  --muted: #70665f;
  --line: #ddd0c5;
  --paper: #fffaf5;
  --surface: #f5eee7;
  --coffee: #4d3022;
  --espresso: #2b1b15;
  --caramel: #b56b45;
  --orange: #e97825;
  --sage: #66785f;
  --danger: #b73d3d;
  --warn: #b47b23;
  --ok: #4f7651;
  --shadow: 0 18px 45px rgba(62, 39, 28, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

img {
  display: block;
  max-width: 100%;
}

.activation-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  background: #fff;
}

.activation-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: 34px;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(43, 27, 21, .92), rgba(77, 48, 34, .76)),
    url("assets/cafe-bolsa.jpg") center/cover;
}

.activation-brand img,
.brand img {
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid rgba(255, 250, 245, .9);
}

.activation-brand img {
  width: 150px;
  height: 150px;
}

.activation-brand h1 {
  margin: 18px 0 8px;
  font-size: 46px;
  line-height: 1;
}

.activation-brand p {
  max-width: 360px;
  color: rgba(255, 255, 255, .84);
  line-height: 1.5;
}

.activation-card {
  width: min(100% - 36px, 540px);
  margin: auto;
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.activation-card h2,
.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

.activation-card p,
.muted {
  color: var(--muted);
}

.license-preview {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  color: #fff;
  background:
    linear-gradient(rgba(43, 27, 21, .94), rgba(43, 27, 21, .96)),
    url("assets/logo-cafe-mia-mor.jpg") center/cover;
}

.brand {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.brand img {
  width: 72px;
  height: 72px;
  border-width: 3px;
}

.brand strong {
  display: block;
  font-size: 21px;
}

.brand span {
  color: rgba(255, 255, 255, .76);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 42px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .08);
  border: 0;
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: var(--sage);
}

.cash-status {
  margin-top: auto;
  padding: 13px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .15);
}

.cash-status span {
  display: block;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  background: rgba(255, 250, 245, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar-actions,
.toolbar,
.mini-actions,
.form-actions,
.inline-form,
.report-tabs,
.payment-methods,
.ticket-actions,
.pagination-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.search-box {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  outline: 0;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(102, 120, 95, .18);
}

.view {
  display: none;
  padding: 22px;
}

.active-view {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel,
.product-card,
.entity-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
}

.kpi-card span,
.panel-heading span,
.entity-card span,
.timeline-item span,
.list-item span {
  color: var(--muted);
}

.kpi-card strong {
  color: var(--coffee);
  font-size: 25px;
}

.kpi-card small {
  color: var(--muted);
}

.dashboard-grid,
.section-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.dashboard-grid .wide,
.section-grid .wide {
  grid-column: span 2;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-heading h2 {
  font-size: 20px;
}

.panel-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.product-browser {
  min-height: calc(100vh - 130px);
}

.product-grid,
.entity-grid,
.report-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.product-card {
  min-height: 148px;
  display: grid;
  gap: 10px;
  padding: 14px;
  text-align: left;
}

.product-card strong {
  font-size: 16px;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.price {
  color: var(--coffee);
  font-weight: 900;
}

.cart-panel {
  position: sticky;
  top: 84px;
}

.sales-cancel-panel {
  margin-top: 18px;
}

.cart-items,
.compact-list,
.timeline,
.rank-list,
.alert-list {
  display: grid;
  gap: 10px;
}

.cart-item,
.list-item,
.timeline-item,
.rank-item,
.alert-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.cancelled-sale {
  opacity: .72;
  background: #fff0ee;
}

.cancelled-sale strong {
  text-decoration: line-through;
}

.cart-item {
  align-items: center;
}

.cart-item span,
.timeline-item span {
  display: block;
  margin-top: 4px;
}

.qty-control {
  display: grid;
  grid-template-columns: 32px 32px 32px;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.qty-control button,
.mini-actions button,
.ticket-actions button,
.ghost-button,
.report-tabs button,
.pagination-actions button {
  min-height: 36px;
  padding: 8px 11px;
  color: var(--coffee);
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 40px;
  padding: 9px 13px;
  color: #fff;
  border: 0;
  font-weight: 900;
}

.primary-action {
  background: var(--sage);
}

.secondary-action {
  background: var(--caramel);
}

.danger-action {
  background: var(--danger);
}

.full {
  width: 100%;
  justify-content: center;
}

.discount-row,
.totals {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.total-line {
  padding-top: 10px;
  border-top: 2px solid var(--line);
  color: var(--coffee);
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-actions {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  color: #fff;
  background: var(--ok);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.warn,
.alert-item.warn {
  background: #fff4da;
  color: var(--warn);
}

.status-pill.danger,
.alert-item.danger {
  background: #ffe6e6;
  color: var(--danger);
}

.entity-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.inline-form {
  align-items: end;
  margin-bottom: 12px;
}

.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 150px;
}

.report-tabs {
  margin-bottom: 14px;
}

.report-tabs button.active,
.payment-methods button.active,
.pagination-actions button.active {
  color: #fff;
  background: var(--sage);
  border-color: var(--sage);
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.preview-image {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(440px, calc(100vw - 36px));
  padding: 13px 15px;
  color: #fff;
  background: var(--espresso);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.receipt {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .receipt,
  .receipt * {
    visibility: visible;
  }

  .receipt {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    width: 78mm;
    padding: 9mm;
    color: #000;
    background: #fff;
    font-family: Arial, sans-serif;
  }
}

@media (max-width: 1120px) {
  .pos-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .wide,
  .section-grid .wide {
    grid-column: auto;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .activation-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .view {
    padding: 14px;
  }
}
