:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #64748b;
  --line: #dbe3ea;
  --primary: #2f7f7a;
  --primary-dark: #256965;
  --secondary: #17202a;
  --danger: #b42318;
  --warning: #b7791f;
  --soft-blue: #e8f3f1;
  --soft-green: #eaf8f3;
  --soft-red: #fff0ed;
  --shadow: 0 12px 32px rgba(22, 34, 51, 0.08);
  --graphite: #17202a;
  --graphite-dark: #101820;
  --argio-teal: #2f7f7a;
  --argio-mist: #e4eae8;
}

* {
  box-sizing: border-box;
}
[hidden] { display:none !important; }
dialog:not([open]) { display:none !important; }

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--graphite-dark);
  z-index: 20;
  padding: 18px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background: white;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.login-brand {
  color: var(--text);
  padding: 0 0 10px;
}

.login-brand span {
  color: var(--muted);
}

.login-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #101820;
  color: white;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.sidebar > .brand {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 14px;
  background: #f7f8f6;
  border: 1px solid rgba(228, 234, 232, 0.92);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--graphite-dark);
  border-radius: 8px;
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand .brand-mark {
  width: 62px;
  height: 52px;
}

.sidebar-logo {
  width: 148px;
  height: 116px;
  filter: none;
}

.brand span {
  display: block;
  color: #a9b7c5;
  font-size: 13px;
  margin-top: 2px;
}

.sidebar > .brand span {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.nav-parent {
  border: 0;
  color: #dce6ef;
  background: transparent;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
}

.nav-item:hover,
.nav-item.active,
.nav-parent:hover,
.nav-parent.active {
  background: #22313f;
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--argio-teal);
}

.nav-badge {
  float: right;
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--warning);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-parent {
  width: 100%;
  position: relative;
}

.nav-parent::after {
  content: "›";
  position: absolute;
  right: 14px;
  transition: transform 0.2s ease;
}

.nav-group.open .nav-parent::after {
  transform: rotate(90deg);
}

.nav-sub {
  max-height: 0;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  margin-left: 12px;
  transform: translateX(-8px);
  transition: max-height 0.22s ease, opacity 0.18s ease, padding 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.nav-group.open .nav-sub {
  max-height: 46px;
  min-height: 38px;
  opacity: 1;
  padding: 10px 14px;
  transform: translateX(0);
  pointer-events: auto;
}

.nav-sub::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: rgba(220, 230, 239, 0.42);
  vertical-align: middle;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar > button + button {
  margin-left: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 17px;
}

.topbar p {
  color: var(--muted);
  margin-top: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.crm-grid {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.75fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.primary,
.secondary,
.ghost,
.danger-button {
  border: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: var(--secondary);
  color: white;
}

.ghost {
  background: #eef2f6;
  color: var(--text);
}

.danger-button {
  background: var(--soft-red);
  color: var(--danger);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-bar {
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.bulk-form {
  display: grid;
  grid-template-columns: 150px 90px minmax(140px, 1fr) auto;
  gap: 8px;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.check-line input,
.product-check {
  width: 18px;
  min-height: 18px;
}

.wide {
  width: 100%;
}

.form {
  display: grid;
  gap: 10px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 10px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.form, .form label, .form fieldset, .split > * { min-width:0; }
.form input, .form select, .form textarea { min-width:0; max-width:100%; }
.row-actions > button { flex:0 0 auto; max-width:100%; padding:9px 14px; line-height:1.35; }

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
}

.search {
  max-width: 260px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344256;
  font-size: 12px;
  font-weight: 700;
}

.tag.danger {
  background: var(--soft-red);
  color: var(--danger);
}

.tag.warn {
  background: #fff6df;
  color: var(--warning);
}

.tag.ok {
  background: var(--soft-green);
  color: var(--secondary);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.sales-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.selected-row {
  background: var(--soft-blue);
}

.selected-row td:first-child {
  border-left: 3px solid var(--primary);
}

.sale-detail {
  display: grid;
  gap: 16px;
}

.sale-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sale-detail-head strong {
  font-size: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 14px;
}

.detail-grid span,
.sale-items span {
  color: var(--muted);
  font-size: 13px;
}

.sale-items {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sale-items p {
  line-height: 1.5;
}

.pickup-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.replenishment-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pickup-column {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.replenishment-column {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.pickup-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.pickup-column-head h3 {
  margin: 0;
  font-size: 14px;
}

.pickup-column-head span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pickup-column-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
}

.pickup-card {
  background: white;
}

.pickup-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.list,
.cards {
  display: grid;
  gap: 10px;
}

.item,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.item strong,
.card strong {
  display: block;
  margin-bottom: 4px;
}

.item p,
.card p {
  color: var(--muted);
  font-size: 14px;
}

.muted,
.stock-detail {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.product-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef2f6;
}

.product-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 4px;
}

.photo-preview {
  min-height: 0;
}

.photo-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.register-center {
  display: grid;
  gap: 16px;
}

.register-center h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(16, 24, 32, 0.46);
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, 88vh);
  overflow: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  padding: 16px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.context-tools,
.context-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft, #f6f8fa);
}

.panel-actions { min-width:0; }
.panel-head:has(> .panel-actions) { flex-wrap:wrap; align-items:flex-start; }
.panel-head > .panel-actions { flex:1 1 360px; }
.panel-head > .panel-actions > .search { flex:1 1 200px; min-width:0; }
.panel-actions > button:not(.dialog-close), .context-tools > button, .context-bar > button { flex-shrink:0; max-width:100%; padding-top:9px; padding-bottom:9px; line-height:1.35; }

.context-tools > span { margin-right: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.context-bar { justify-content: space-between; background: white; }
.context-bar > div { display: grid; gap: 3px; }
.context-bar span { color: var(--muted); font-size: 13px; }

.app-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(16, 24, 32, 0.3);
}

.support-dialog { width: min(1120px, calc(100vw - 32px)); }
.support-dialog .dialog-card { min-height: 240px; }
.support-overlay-view { display: block !important; }
.support-overlay-view > .grid { margin: 0; }

.app-dialog::backdrop {
  background: rgba(16, 24, 32, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-card {
  max-height: min(860px, calc(100vh - 32px));
  overflow-y: auto;
  padding: 24px;
  background: var(--surface, #fff);
  container-type:inline-size;
}

@container (max-width:540px) {
  .dialog-card .split, .dialog-card .compact-form { grid-template-columns:minmax(0,1fr); }
  .dialog-card .context-tools > span { flex-basis:100%; }
  .dialog-card .context-tools > button { flex:1 1 180px; }
}

@media (max-width:640px) {
  .app-dialog .dialog-card { padding:16px; }
  .panel-head { flex-wrap:wrap; }
  .panel-head > div { min-width:0; }
  .app-dialog .panel-head { flex-wrap:nowrap; align-items:flex-start; }
  .panel-head > .panel-actions { justify-content:flex-start; }
  .panel-head > .panel-actions > .search { max-width:none; flex-basis:100%; }
}

.dialog-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.dialog-close {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover { background: var(--soft, #f4f6f8); color: var(--text); }

body:has(.app-dialog[open]) { overflow: hidden; }

.history-list {
  display: grid;
  gap: 12px;
}

.history-month {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.history-month-head,
.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.history-month-head {
  background: #f8fafc;
}

.history-month-head span {
  color: var(--muted);
  font-size: 13px;
}

.history-row {
  grid-template-columns: 120px 80px minmax(140px, 1fr) 150px;
  align-items: center;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row strong {
  color: var(--danger);
}

.history-row.entrada strong {
  color: var(--primary);
}

.history-row small {
  color: var(--muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(8, minmax(210px, 1fr));
  gap: 12px;
  overflow: auto;
}

.lane {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 240px;
}

.simulation-box {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.simulation-box summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.simulation-box form {
  margin-top: 10px;
}

.crm-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 12px;
}

.crm-toolbar .selected {
  background: var(--soft-blue);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(47, 127, 122, 0.2);
}

.lane h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

.lead-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.lead-card-head,
.lead-card-foot {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.lead-card-head span,
.lead-card-foot span:not(.tag) {
  color: var(--muted);
  font-size: 12px;
}

.lead-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(47, 127, 122, 0.16);
}

.lead-card.has-new-message {
  border-color: #f0c15f;
  background: #fffaf0;
  box-shadow: inset 4px 0 0 var(--warning);
}

.lead-card.has-new-message.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(47, 127, 122, 0.16), inset 4px 0 0 var(--warning);
}

.lead-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0;
}

.lead-card select {
  min-height: 34px;
}

.crm-detail {
  align-self: start;
  position: sticky;
  top: 16px;
}

.crm-customer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.crm-customer-panel div {
  display: grid;
  gap: 4px;
}

.crm-customer-panel span {
  color: var(--muted);
  font-size: 12px;
}

.stage-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stage-buttons button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
}

.stage-buttons button.selected {
  border-color: var(--primary);
  background: var(--soft-blue);
  color: var(--primary-dark);
}

.message-thread {
  height: 330px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message {
  max-width: 86%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.message.out {
  align-self: flex-end;
  background: var(--soft-green);
  border-color: #b7e4d4;
}

.message.in {
  align-self: flex-start;
}

.message p {
  color: var(--text);
  font-size: 14px;
}

.message span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

.reply-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.quick-replies {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quick-replies button {
  min-height: 32px;
  font-size: 12px;
  padding: 0 10px;
}

.quick-reply-manager {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.quick-reply-manager summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quick-reply-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.quick-reply-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.quick-reply-row div {
  display: grid;
  gap: 3px;
}

.quick-reply-row span:not(.tag) {
  color: var(--muted);
  font-size: 12px;
}

.crm-product-results {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.crm-product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.crm-product-card:hover {
  border-color: var(--primary);
  background: var(--soft-blue);
}

.crm-product-card span {
  color: var(--muted);
  font-size: 12px;
}

.crm-product-card em {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--primary-dark);
  font-style: normal;
  font-weight: 800;
}

.compact {
  min-height: 80px;
  margin-top: 12px;
}

.shelf-map {
  display: grid;
  gap: 14px;
}

.layout-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.layout-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.layout-section-head strong {
  display: block;
}

.layout-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.layout-gondola-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 240px));
  gap: 10px;
  padding: 12px;
}

.shelf {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.layout-card {
  width: 100%;
  height: 168px;
  text-align: left;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  overflow: hidden;
}

.layout-card.selected {
  border-color: var(--primary);
  background: var(--soft-blue);
  box-shadow: 0 0 0 2px rgba(47, 127, 122, 0.14);
}

.shelf strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.layout-editor-panel {
  padding: 0;
  overflow: hidden;
}

.layout-editor-head {
  padding: 18px 20px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.layout-view-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f5f7fa;
}

.layout-view-switch button {
  border: 0;
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
}

.layout-view-switch button.active {
  color: white;
  background: var(--secondary);
}

.layout-editor {
  display: grid;
  grid-template-columns: 210px minmax(480px, 1fr) 270px;
  min-height: 650px;
}

.layout-palette,
.layout-detail-panel {
  padding: 18px;
  background: white;
}

.layout-palette {
  border-right: 1px solid var(--line);
}

.layout-detail-panel {
  border-left: 1px solid var(--line);
}

.layout-detail-panel .panel-head {
  margin-bottom: 10px;
}

.layout-detail-panel .wide {
  width: 100%;
  margin-top: 12px;
}

.layout-unplaced-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 24px;
}

.layout-space-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 10px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f7fa;
}

.layout-space-switch button {
  border: 0;
  border-radius: 6px;
  padding: 8px 5px;
  color: var(--muted);
  background: transparent;
}

.layout-space-switch button.active {
  color: white;
  background: var(--secondary);
}

.layout-add-space {
  width: 100%;
  margin: 8px 0 12px;
}

.layout-dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.layout-dimensions label:last-child { grid-column: 1 / -1; }
.layout-dimensions label { color: var(--muted); font-size: 11px; }
.layout-dimensions input,
.layout-dimensions select { width: 100%; margin-top: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.layout-combined-access { display: flex; gap: 7px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 12px; }
.layout-scale-note { min-height: 32px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.layout-unplaced-list button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.layout-unplaced-list button:hover {
  border-color: var(--primary);
  background: var(--soft-blue);
}

.layout-unplaced-list span,
.layout-all-placed,
.layout-fixed-legend span {
  color: var(--muted);
  font-size: 12px;
}

.layout-fixed-legend {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.layout-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 3px;
}

.layout-dot.entry { background: #2f9d75; }
.layout-dot.checkout { background: #337ab7; }
.layout-dot.stock { background: #d88342; }

.layout-canvas-wrap {
  min-width: 0;
  padding: 14px;
  background: #f4f6f9;
}

.layout-canvas-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-height: 42px;
  gap: 8px;
  margin-bottom: 10px;
}

.layout-canvas-toolbar span {
  flex: 1 1 180px;
  color: var(--muted);
  font-size: 12px;
}

.layout-canvas-toolbar button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.store-floor {
  position: relative;
  min-height: 565px;
  overflow: hidden;
  border: 7px solid #445064;
  border-radius: 5px;
  background-color: white;
  background-image: linear-gradient(rgba(80, 94, 115, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(80, 94, 115, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  box-shadow: 0 6px 18px rgba(29, 44, 66, 0.09);
  transform-origin: center;
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.store-floor.illustration-mode {
  transform: perspective(1100px) rotateX(48deg) rotateZ(-1deg) scale(0.9);
  box-shadow: 24px 30px 26px rgba(29, 44, 66, 0.2);
  pointer-events: none;
}

.store-zone {
  position: absolute;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 10px;
  border: 1px dashed rgba(73, 89, 112, 0.38);
  border-radius: 9px;
  color: #536175;
  background: rgba(220, 226, 234, 0.44);
}

.editable-zone {
  z-index: 1;
  min-width: 0;
  min-height: 0;
  text-align: left;
  touch-action: none;
}

.editable-zone.selected {
  border-style: solid;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 127, 122, 0.16);
}

.editable-zone i {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--primary);
  cursor: nwse-resize;
}

.store-access {
  position: absolute;
  z-index: 4;
  width: 88px;
  min-height: 26px;
  padding: 5px 7px;
  touch-action: none;
  border: 2px solid white;
  border-radius: 7px;
  color: white;
  background: #2f9d75;
  box-shadow: 0 3px 8px rgba(29, 44, 66, 0.2);
  font-size: 9px;
  font-weight: 800;
}

.store-access.exit { background: #337ab7; }

.storage-floor {
  background-color: #f8f5ef;
}

.store-zone span { font-size: 11px; }
.stock-zone { left: 2%; top: 3%; width: 23%; height: 26%; background: rgba(216, 131, 66, 0.09); border-color: rgba(216, 131, 66, 0.48); }
.produce-zone { right: 2%; top: 3%; width: 25%; height: 28%; background: rgba(47, 157, 117, 0.09); border-color: rgba(47, 157, 117, 0.45); }
.checkout-zone { right: 2%; bottom: 4%; width: 27%; height: 21%; background: rgba(51, 122, 183, 0.08); border-color: rgba(51, 122, 183, 0.45); }

.store-entry {
  position: absolute;
  left: 42%;
  bottom: -7px;
  width: 18%;
  padding: 4px;
  border-radius: 7px 7px 0 0;
  color: white;
  background: #2f9d75;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.store-flow {
  position: absolute;
  left: 47%;
  bottom: 8%;
  color: #337ab7;
  font-size: 34px;
  font-weight: 800;
  transform: rotate(-90deg);
}

.floor-gondola {
  position: absolute;
  z-index: 2;
  display: grid;
  place-content: center;
  min-width: 72px;
  min-height: 42px;
  padding: 5px 8px;
  touch-action: none;
  user-select: none;
  border: 2px solid #8592a5;
  border-radius: 6px;
  color: #172b4d;
  background: linear-gradient(180deg, #eef1f5 0 22%, #cbd4df 22% 33%, #eef1f5 33% 55%, #cbd4df 55% 66%, #eef1f5 66% 88%, #cbd4df 88%);
  box-shadow: 0 5px 9px rgba(29, 44, 66, 0.16);
}

.floor-gondola span,
.floor-gondola small {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.82);
}

.floor-gondola small { color: #536175; }

.floor-gondola.selected {
  z-index: 3;
  border-color: #e36f32;
  box-shadow: 0 0 0 4px rgba(227, 111, 50, 0.2), 0 6px 12px rgba(29, 44, 66, 0.18);
}

.floor-gondola.dragging {
  opacity: 0.86;
  cursor: grabbing;
}

@media (max-width: 1180px) {
  .layout-editor { grid-template-columns: 180px minmax(430px, 1fr); }
  .layout-detail-panel { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .layout-detail-panel .list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
}

@media (max-width: 760px) {
  .layout-editor { display: block; }
  .layout-palette { border-right: 0; border-bottom: 1px solid var(--line); }
  .layout-unplaced-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .layout-canvas-wrap { padding: 8px; }
  .store-floor { min-height: 470px; }
  .layout-canvas-toolbar { flex-wrap: wrap; }
  .layout-canvas-toolbar span { flex-basis: 100%; }
}

.layout-card strong,
.layout-card p {
  min-width: 0;
}

.layout-card strong span,
.layout-card p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.layout-card strong span {
  max-width: 92px;
  white-space: nowrap;
}

.layout-card p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bar {
  height: 8px;
  background: #e8eef5;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 6px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--secondary);
}

.gondola-visual {
  min-height: 420px;
}

.allocation-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

#users-view .allocation-layout {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

#users-view .allocation-rail {
  display: none;
}

.allocation-rail {
  align-self: start;
  position: sticky;
  top: 16px;
}

.allocation-gondola-list {
  display: grid;
  gap: 12px;
}

.allocation-sector {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.allocation-sector-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.allocation-sector-head strong {
  font-size: 13px;
}

.allocation-sector-head span {
  color: var(--muted);
  font-size: 12px;
}

.allocation-gondola-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  text-align: left;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.allocation-gondola-card:hover,
.allocation-gondola-card.selected {
  border-color: var(--primary);
  background: var(--soft-blue);
}

.allocation-gondola-card strong {
  font-size: 14px;
}

.allocation-gondola-card span,
.allocation-gondola-card small {
  color: var(--muted);
}

.gondola-image-wrap {
  position: relative;
  width: min(680px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.gondola-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.allocation-summary {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.allocation-summary strong {
  font-size: 14px;
}

.allocation-summary span {
  color: var(--muted);
  font-size: 12px;
}

.gondola-slots {
  position: absolute;
  left: 24%;
  right: 8%;
  top: 7%;
  bottom: 13%;
  display: grid;
  gap: 8px;
}

.slot {
  border: 1px dashed rgba(47, 127, 122, 0.72);
  background: rgba(232, 243, 241, 0.62);
  color: var(--graphite-dark);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4px;
}

.slot span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.slot:hover,
.slot.selected {
  background: rgba(47, 127, 122, 0.88);
  color: white;
  border-style: solid;
}

.slot.selected span,
.slot:hover span {
  color: white;
}

.slot.filled {
  background: rgba(23, 32, 42, 0.74);
  color: white;
  border-style: solid;
}

.slot.filled:not(.selected) {
  cursor: not-allowed;
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.product-button {
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 8px;
  padding: 12px;
  min-height: 116px;
}

.product-button:hover {
  border-color: var(--primary);
  background: var(--soft-blue);
}

.product-button strong {
  display: block;
  margin-bottom: 6px;
}

.product-button span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.checkout {
  align-self: start;
  position: sticky;
  top: 16px;
}

.cart-list {
  display: grid;
  gap: 8px;
  min-height: 160px;
  margin-bottom: 12px;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.cart-row button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #eef2f6;
}

.checkout label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 6px;
}

.payment-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.payment-option {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
  font-weight: 800;
}

.payment-option:hover,
.payment-option.selected {
  border-color: var(--primary);
  background: var(--soft-blue);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(47, 127, 122, 0.18);
}

.total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin: 16px 0;
  padding-top: 14px;
}

.total-line strong {
  font-size: 22px;
}

.change-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -6px 0 16px;
  color: var(--muted);
}

.change-line strong {
  color: var(--text);
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #101820;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: 100vh;
    z-index: 2;
  }

  .sidebar > .brand {
    flex-direction: row;
    justify-content: center;
    padding: 10px 12px;
  }

  .sidebar-logo {
    width: 92px;
    height: 72px;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid.two,
  .crm-grid,
  .pos-layout,
  .allocation-layout {
    grid-template-columns: 1fr;
  }

  .bulk-bar,
  .bulk-form {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .checkout {
    position: static;
  }

  .allocation-rail {
    position: static;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    grid-template-columns: 1fr 1fr;
  }

  .metrics,
  .split,
  .kanban,
  .compact-form,
  .history-row,
  .history-month-head {
    grid-template-columns: 1fr;
  }

  .gondola-slots {
    gap: 4px;
  }

  .slot {
    font-size: 10px;
  }

  .slot span {
    display: none;
  }

  .search {
    max-width: none;
  }
}
/* Validação PIX */
.pix-layout {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.pix-validation-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.pix-validation-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  border-radius: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pix-validation-card.selected {
  border-color: #466f52;
  box-shadow: 0 0 0 2px rgba(70, 111, 82, .12);
}

.pix-validation-card span:first-child {
  display: grid;
  gap: 3px;
}

.pix-validation-card .tag {
  justify-self: start;
}

.pix-score,
.pix-score-large {
  font-weight: 800;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.pix-score {
  width: 44px;
  height: 44px;
  grid-row: span 2;
  grid-column: 2;
  grid-row-start: 1;
}

.pix-score-large {
  width: 100px;
  height: 100px;
  font-size: 32px;
}

.pix-score-large small {
  font-size: 12px;
  margin-top: -24px;
}

.pix-score.ok, .pix-score-large.ok { background: #dcf4e2; color: #17632d; }
.pix-score.warning, .pix-score-large.warning { background: #fff0c7; color: #805600; }
.pix-score.danger, .pix-score-large.danger { background: #ffe0df; color: #9d2520; }

.pix-result-panel { margin-bottom: 28px; }

.pix-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.pix-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(430px, 1.15fr);
  gap: 24px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pix-result-panel .compact-form {
  grid-template-columns: 1fr;
}

.low-confidence {
  border-color: #d59a20 !important;
  background: #fff9e9 !important;
}

.rule-list {
  display: grid;
  gap: 9px;
  max-height: 590px;
  overflow: auto;
}

.rule-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #87948c;
  border-radius: 10px;
}

.rule-card.critical { border-left-color: #b52d27; background: #fffafa; }
.rule-card > div { display: flex; justify-content: space-between; gap: 12px; }
.rule-card p { margin: 7px 0 4px; }
.rule-card small { display: block; color: var(--muted); }
.rule-card footer { margin-top: 8px; font-size: 12px; }

.critical-banner {
  padding: 13px 16px;
  background: #ffe3e1;
  color: #8f211d;
  border-radius: 10px;
  font-weight: 700;
  margin-bottom: 18px;
}

.file-drop {
  border: 1px dashed #82978a;
  border-radius: 12px;
  padding: 15px;
  background: #f8fbf8;
}

.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.ocr-raw { margin-top: 18px; }
.ocr-raw pre { white-space: pre-wrap; max-height: 260px; overflow: auto; background: #f5f6f5; padding: 14px; border-radius: 9px; }
.pix-review-bar { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.pix-review-bar input { flex: 1; }
.danger-button { background: #9d2e29; color: #fff; border: 0; border-radius: 9px; padding: 11px 15px; }
.pix-disclaimer { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.tag.danger { background: #ffe0df; color: #9d2520; }
.tag.warning { background: #fff0c7; color: #805600; }

@media (max-width: 1100px) {
  .pix-layout, .pix-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .field-grid { grid-template-columns: 1fr; }
  .pix-review-bar { align-items: stretch; flex-direction: column; }
}

.operation-form { margin: 16px 0; border: 1px solid #ddd; border-radius: 8px; padding: 12px; }
.operation-form summary { cursor: pointer; font-weight: 600; }
.operation-form form { display: grid; gap: 12px; padding-top: 16px; }
.operation-form label { display: grid; gap: 6px; }
.operation-feedback { color: #a12525; }
.return-line,.purchase-line { padding: 12px; border: 1px solid #ddd; display: grid; gap: 8px; }

/* Authentication feedback stays inside the access card, above the page overlay. */
.login-screen { overflow-y: auto; }
.login-card { margin: auto; }
.auth-form { display: grid; gap: 10px; }
.auth-form[hidden], .auth-feedback[hidden], .caps-warning[hidden] { display: none !important; }
.auth-form h2 { margin: 0; font-size: 21px; }
.auth-description { color: var(--muted); line-height: 1.5; margin: 0 0 8px; }
.auth-form label { font-weight: 600; font-size: 14px; }
.password-field { display: flex; gap: 8px; align-items: stretch; }
.password-field input { flex: 1; min-width: 0; width: 100%; }
.password-field button { flex: 0 0 auto; min-width: 78px; }
.auth-link { background: transparent; border: 0; color: var(--primary-dark); text-decoration: underline; padding: 10px; }
.auth-feedback { padding: 12px; border-radius: 6px; margin: 3px 0; line-height: 1.45; background: var(--soft-red); color: var(--danger); border: 1px solid #e9b1a9; }
.auth-feedback.success { color: #185b38; background: var(--soft-green); border-color: #9dccb0; }
.caps-warning { color: #7c5000; font-size: 13px; margin: 0; }
.auth-form button:disabled { opacity: .65; cursor: wait; }
.auth-form input[aria-invalid="true"] { border-color: var(--danger); }
.toast { z-index: 30; }
/* Management dashboard */
.dash-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-top:20px; }
.dash-grid > :last-child:nth-child(odd) { grid-column:1 / -1; }
.dash-block { min-width:0; padding:24px; }
.dash-block-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
.dash-block-head h2 { margin:6px 0 8px; font-size:21px; }
.dash-block-head p,.dash-note { color:var(--muted); font-size:13px; line-height:1.55; margin:8px 0 12px; }
.dash-kicker { color:var(--primary); font-size:11px; font-weight:750; letter-spacing:1.4px; }
.dash-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); gap:10px; }
.dash-metric { text-align:left; border:1px solid var(--line); background:#f8fafb; border-radius:10px; padding:16px; display:flex; flex-direction:column; gap:7px; min-height:125px; color:var(--text); }
.dash-metric strong { font-size:27px; letter-spacing:-.7px; overflow-wrap:anywhere; }
.dash-metric span { font-size:13px; line-height:1.4; }
.dash-metric small { color:var(--primary); font-size:11px; margin-top:auto; }
.dash-metric:disabled { cursor:default; opacity:1; }
.dash-metric:hover:not(:disabled),.dash-metric:focus-visible { border-color:var(--primary); background:var(--soft-blue); }
.dash-metric.danger { background:var(--soft-red); border-color:#efb3ab; }
.dash-metric.danger strong { color:var(--danger); }
.dash-metric.warning { background:#fffbef; border-color:#ead6a5; }
.dash-attention { border-top:3px solid var(--primary); padding:22px; }
.dash-attention .dash-metric { min-height:110px; }
.dash-unit-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:18px; }
.dash-unit-row span { background:var(--soft-blue); padding:7px 12px; border-radius:20px; font-size:13px; }
.dash-register-summary { margin:20px 0 10px; font-size:14px; }
.dash-dialog { border:1px solid var(--line); border-radius:16px; padding:24px; width:min(760px,92vw); max-height:85vh; overflow:auto; color:var(--text); }
.dash-dialog::backdrop { background:#10182099; }
.dash-dialog > form { text-align:right; }
.dash-detail-row { display:flex; justify-content:space-between; gap:16px; border-bottom:1px solid var(--line); padding:15px 0; align-items:center; }
.dash-detail-row p { color:var(--muted); font-size:13px; }
.cashier-shortcuts { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:22px; background:var(--soft-blue); border:1px solid #c2dad5; border-radius:12px; margin:16px 0; }
.cashier-shortcuts > div { margin-right:auto; }
.cashier-shortcuts p { margin:6px 0 0; font-size:13px; color:var(--muted); }

/* Frente de caixa dedicada */
body.pos-mode { overflow:hidden; background:#09131f; }
body.pos-mode .app-shell { display:block; min-height:100vh; }
body.pos-mode .sidebar, body.pos-mode .topbar { display:none; }
body.pos-mode .demo-banner { display:none; }
body.pos-mode .main { padding:0; }
body.pos-mode #pos-view.active { display:block; width:100vw; height:100vh; }
.pos-workspace { width:100%; height:100%; padding:10px; display:grid; grid-template-columns:112px minmax(360px,31vw) minmax(0,1fr); grid-template-rows:minmax(0,1fr) 116px; gap:10px; background:#0b1521; color:#f8fafc; }
.pos-queue,.pos-cart-panel,.pos-catalog-panel,.pos-total-panel,.pos-actions { border:1px solid #26384b; border-radius:12px; overflow:hidden; }
.pos-queue { grid-row:1 / 3; background:#112d43; display:flex; flex-direction:column; }
.pos-brand { flex:0 0 auto; height:76px; margin:8px; padding:7px; display:grid; place-items:center; border-radius:9px; background:#f8faf9; border:1px solid rgba(255,255,255,.18); }
.pos-brand img { display:block; width:100%; height:100%; object-fit:contain; }
.pos-section-title { padding:14px 10px; display:flex; align-items:center; justify-content:space-between; gap:6px; border-bottom:1px solid rgba(255,255,255,.12); }
.pos-section-title span,.pos-cart-head span,.pos-catalog-head span,.pos-total-panel>span,.pos-modal-head span { display:block; color:#7dd3fc; font-size:10px; letter-spacing:.12em; font-weight:900; }
.pos-section-title strong { font-size:12px; }
.pos-section-title button { width:28px; height:28px; border:0; border-radius:8px; background:rgba(255,255,255,.1); color:white; }
.pos-queue-list { min-height:0; overflow-y:auto; padding:8px; display:grid; align-content:start; gap:8px; }
.pos-queue-card { border:1px solid rgba(255,255,255,.12); border-radius:9px; padding:9px 7px; background:#173c57; color:white; text-align:left; display:grid; gap:4px; }
.pos-queue-card:hover,.pos-queue-card.active { border-color:#7dd3fc; background:#1c4d6f; }
.pos-queue-card strong { font-size:12px; overflow-wrap:anywhere; }.pos-queue-card span { font-size:10px; color:#cce8f7; }
.pos-queue-empty { padding:16px 5px; text-align:center; color:#a9bfd0; font-size:11px; }
.pos-cart-panel { background:#101b28; display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.pos-cart-head,.pos-catalog-head { min-height:64px; padding:12px 14px; display:flex; align-items:center; justify-content:space-between; gap:10px; border-bottom:1px solid #26384b; }
.pos-cart-head strong,.pos-catalog-head strong { display:block; font-size:18px; }.pos-cart-head button,.pos-catalog-head button { border:1px solid #3a4c5f; background:#182638; color:#dbe8f2; border-radius:8px; padding:8px 11px; }
.pos-cart-list { min-height:0; overflow-y:auto; padding:8px 12px; }
.pos-cart-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:10px 4px; border-bottom:1px solid #26384b; }
.pos-cart-row.cancelled { opacity:.58; text-decoration:line-through; }.pos-cart-row strong { display:block; }.pos-cart-row span { color:#9eb0c1; font-size:12px; }.pos-cart-row-price { text-align:right; }
.pos-cart-empty { height:100%; min-height:180px; display:grid; place-items:center; text-align:center; color:#71859a; }
.barcode-bar { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:8px; padding:10px; background:#08111c; border-top:1px solid #26384b; }
.barcode-bar span { font-size:23px; color:#7dd3fc; }.barcode-bar input,.pos-catalog-head input { border:1px solid #38506a; background:#111f2e; color:white; }.barcode-bar button { border:0; border-radius:8px; padding:10px 12px; background:#2f7f7a; color:white; font-weight:800; }
.pos-catalog-panel { background:#f4f7f9; color:#17202a; display:grid; grid-template-rows:auto minmax(0,1fr); }
.pos-catalog-head { background:white; border-color:#dbe3ea; }.pos-catalog-head>div { margin-right:auto; }.pos-catalog-head span { color:#2f7f7a; }.pos-catalog-head input { width:min(250px,34%); background:#f7fafc; color:#17202a; }
.pos-catalog-grid { padding:14px; overflow-y:auto; display:grid; grid-template-columns:repeat(auto-fill,minmax(145px,1fr)); align-content:start; gap:10px; }
.pos-category-card,.pos-product-card { min-height:106px; border:1px solid #d8e1e8; background:white; border-radius:11px; padding:13px; text-align:left; display:flex; flex-direction:column; justify-content:space-between; gap:8px; box-shadow:0 4px 12px rgba(15,23,42,.04); }
.pos-category-card:hover,.pos-product-card:hover { border-color:#2f7f7a; background:#edf8f6; transform:translateY(-1px); }.pos-category-card strong,.pos-product-card strong { font-size:15px; }.pos-category-card span,.pos-product-card span { color:#64748b; font-size:12px; }.pos-product-card em { color:#256965; font-style:normal; font-weight:900; }
.pos-total-panel { background:#f4b400; color:#241a00; padding:14px 18px; display:flex; flex-direction:column; justify-content:center; }.pos-total-panel>span { color:#5c4500; }.pos-total-panel strong { font-size:clamp(28px,3vw,44px); line-height:1.05; }.pos-total-panel small { min-height:16px; font-weight:800; }
.pos-actions { background:#0f1c2b; display:grid; grid-template-columns:1.05fr 1.05fr .9fr 1fr 1fr; gap:8px; padding:8px; }
.pos-action { border:0; border-radius:9px; color:white; font-weight:900; font-size:clamp(13px,1.2vw,17px); display:flex; flex-direction:column; align-items:flex-start; justify-content:space-between; padding:12px; text-align:left; }.pos-action span { font-size:10px; opacity:.7; }.pos-action.finish{background:#059447}.pos-action.cancel{background:#d82c2c}.pos-action.customer{background:#b84caf}.pos-action.functions{background:#a91d1d}.pos-action.consult{background:#123b78}.pos-action:hover{filter:brightness(1.12)}
.pos-modal { width:min(680px,calc(100vw - 32px)); max-height:calc(100vh - 32px); overflow-x:hidden; border:0; border-radius:14px; padding:0 0 18px; color:#17202a; box-shadow:0 24px 80px rgba(0,0,0,.4); }.pos-modal::backdrop{background:rgba(3,10,18,.76)}.compact-modal{width:min(520px,calc(100vw - 32px))}
.pos-modal>*:not(.pos-modal-head){margin-left:20px;margin-right:20px}.pos-modal-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid #dbe3ea}.pos-modal-head h2{margin:2px 0 0}.pos-modal-head button{border:0;background:#edf1f5;border-radius:50%;width:34px;height:34px;font-size:22px}.pos-modal label{display:grid;gap:6px;margin-top:14px}.pos-modal input{width:100%}.pos-payment-total{display:flex;justify-content:space-between;align-items:end;padding:18px 0}.pos-payment-total strong{font-size:34px}.pos-payment-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.pos-payment-summary div{background:#f1f5f8;border-radius:9px;padding:10px}.pos-payment-summary span{display:block;color:#64748b;font-size:12px}.pos-payment-summary strong{font-size:19px}.pos-modal .payment-buttons{margin-top:14px;grid-template-columns:repeat(4,1fr)}.partial-payment-list{display:grid;gap:6px;margin-top:12px}.partial-payment-row{display:flex;justify-content:space-between;padding:8px 10px;background:#f4f7f9;border-radius:8px}.pos-modal-actions{display:flex;justify-content:space-between;gap:10px;padding:18px 0}.pos-choice-list{display:grid;gap:8px;max-height:52vh;overflow-y:auto;margin-top:14px}.pos-choice-list button{border:1px solid #dbe3ea;border-radius:9px;background:#f8fafc;padding:12px;text-align:left}.pos-function-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:18px 0}.pos-function-grid button{min-height:84px;border:1px solid #dbe3ea;border-radius:10px;background:#f6f8fa;font-weight:800}.pos-lock-screen{position:fixed;inset:0;z-index:200;background:#07111d;color:white;display:grid;place-items:center;text-align:center}.pos-lock-screen[hidden]{display:none}.pos-lock-screen strong{display:block;font-size:34px}.pos-lock-screen span{display:block;margin-top:12px;color:#9fb2c5}
.pos-function-grid button.danger-button { background:#d82c2c; color:white; border-color:#b91c1c; }
.cancel-item-line{display:grid;grid-template-columns:minmax(0,1fr) 92px 104px;gap:10px;align-items:end;border:1px solid #dbe3ea;border-radius:10px;background:#f8fafc;padding:12px}.cancel-item-line span{color:#64748b;font-size:13px}.cancel-item-line label{margin:0;font-size:12px;font-weight:800}.cancel-item-line input{height:42px;padding:8px;text-align:center}.pos-choice-list .cancel-item-line button{height:42px;padding:8px;text-align:center;font-weight:900;background:#dc2626;color:#fff;border-color:#b91c1c;box-shadow:0 3px 8px rgba(185,28,28,.24)}.pos-choice-list .cancel-item-line button:hover{background:#b91c1c}@media(max-width:640px){.cancel-item-line{grid-template-columns:1fr 82px}.cancel-item-line>div{grid-column:1/-1}.pos-choice-list .cancel-item-line button{grid-column:2}}
.pos-consult-toolbar { width:calc(100% - 40px); display:grid; grid-template-columns:auto minmax(0,1fr); gap:8px; align-items:center; margin-top:14px; }.pos-consult-toolbar:has(#pos-consult-back[hidden]) { grid-template-columns:minmax(0,1fr); }.pos-consult-toolbar input { min-width:0; width:100%; }
.pos-modal>.wide { width:calc(100% - 40px); }
@media(max-width:1100px){.pos-workspace{grid-template-columns:94px 340px minmax(0,1fr)}.pos-catalog-grid{grid-template-columns:repeat(auto-fill,minmax(125px,1fr))}.pos-actions{grid-template-columns:repeat(5,1fr)}.pos-action{padding:8px;font-size:12px}}
.fulfillment-fields { display:grid; gap:10px; padding:12px 0; }
.fulfillment-fields label { display:grid; gap:5px; font-size:13px; }
.pickup-card:focus { outline:3px solid var(--primary); outline-offset:3px; }
@media (max-width:1100px) { .dash-grid { grid-template-columns:1fr; } }
@media (max-width:600px) { .dash-block { padding:16px; } .dash-block-head,.dash-detail-row { flex-direction:column; } .dash-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .dash-metric { padding:12px; } .dash-metric strong {font-size:22px;} }
.demo-banner { padding:10px 16px; background:#fff3cd; border:1px solid #e4c574; border-radius:8px; margin-bottom:16px; color:#755313; font-size:13px; font-weight:600; }
.batch-picking { background:var(--soft-blue); padding:10px; border-radius:6px; }

/* Respect permission-driven visibility even on grid/flex elements. */
[hidden] { display: none !important; }

.sidebar-user { margin-top:-10px; padding:0 8px; text-align:left; }
.sidebar-user p { margin:0 0 8px; color:#f3f7f6; font-size:15px; font-weight:600; line-height:1.5; overflow-wrap:anywhere; }
.sidebar-user span { display:inline-block; padding:4px 10px; border-radius:12px; background:#203b3a; color:#bce2dc; font-size:12px; line-height:1.4; }
.access-fieldset { border:1px solid var(--line); border-radius:10px; padding:16px; min-width:0; }
.access-fieldset legend { font-weight:700; padding:0 6px; }
#user-screen-permissions { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; }
.access-group h3 { font-size:13px; color:var(--primary); margin:6px 0 10px; }
.access-option { display:flex !important; flex-direction:row !important; align-items:flex-start; gap:9px; padding:7px 0; font-size:13px; line-height:1.4; cursor:pointer; }
.access-option input[type=checkbox] { width:18px; height:18px; min-width:18px; margin:0; accent-color:var(--primary); }
.access-unavailable { color:var(--muted); opacity:.65; cursor:default; }
#user-form-feedback { color:var(--danger); font-size:14px; }
#user-action-permissions { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:2px 16px; }
#users-view > .allocation-layout { grid-template-columns:minmax(0,1fr); align-items:start; }

/* Shared layout safeguards: grids must fit their panel, not just the viewport. */
#cash-sessions-content .metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}
.dash-block-head > div { min-width: 0; }
.dash-block-head > button { flex-shrink: 0; }
.dash-metric { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1040px) {
  /* The expanded menu scrolls with the page instead of covering the workspace. */
  .sidebar { position: static; max-height: none; height: auto; }
}

/* Navigation follows the workday and keeps collapsed links out of keyboard focus. */
.nav { gap: 5px; }
.nav-children { display: grid; gap: 3px; padding: 3px 0 7px; }
.nav-group .nav-sub,.nav-group.open .nav-sub { display:block; width:calc(100% - 12px); max-height:none; min-height:38px; opacity:1; padding:10px 12px; transform:none; pointer-events:auto; font-size:13px; line-height:1.45; }
.nav-parent { font-size:14px; font-weight:600; padding-right:30px; }
.nav-item:focus-visible,.nav-parent:focus-visible { outline:2px solid #a6dbd5; outline-offset:2px; }
.buy-intro { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:8px 0 24px; }
.buy-intro h2 { font-size:26px; letter-spacing:-.6px; margin:8px 0; }
.buy-intro p,.buy-summary p { color:var(--muted); line-height:1.6; }
.buy-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:22px; }
.buy-summary { display:flex; flex-wrap:wrap; gap:24px; align-items:center; padding:22px; background:#e8f3f1; border-radius:12px; margin-bottom:22px; }
.buy-summary > div { display:grid; gap:5px; }
.buy-summary strong { font-size:30px; }
.buy-summary span { font-size:13px; }
.buy-summary p { flex:1 1 300px; font-size:13px; }
.buy-supplier { margin-bottom:22px; }
.buy-product { padding:20px 0; border-top:1px solid var(--line); min-width:0; }
.buy-product-head,.buy-delivery { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; }
.buy-product h3 { margin:10px 0 5px; font-size:18px; }
.buy-select { display:flex; gap:8px; align-items:center; font-size:13px; white-space:nowrap; }
.buy-select input { width:18px; height:18px; accent-color:var(--primary); }
.buy-numbers { display:grid; grid-template-columns:repeat(auto-fit,minmax(125px,1fr)); gap:12px; margin:16px 0; }
.buy-numbers > div { display:grid; gap:7px; padding:12px; background:var(--bg); border-radius:8px; }
.buy-numbers span { font-size:12px; color:var(--muted); }
.buy-numbers strong { font-size:19px; overflow-wrap:anywhere; }
.buy-product details summary { color:var(--primary-dark); cursor:pointer; padding:8px 0; }
.buy-blocker,.buy-warning { padding:10px 12px; border-radius:6px; line-height:1.5; font-size:13px; margin:8px 0; }
.buy-blocker { background:#fff4dd; color:#715315; }
.buy-warning { background:var(--bg); color:var(--muted); }
.buy-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr)); gap:16px; }
.buy-stack { display:grid; gap:20px; }
.buy-approval { border-top:3px solid var(--primary); display:grid; gap:18px; }
.buy-approval form { display:flex; flex-wrap:wrap; align-items:end; gap:14px; }
.buy-approval label,.buy-delivery label { display:grid; gap:6px; font-size:13px; }
.buy-feedback { color:var(--danger); line-height:1.5; flex-basis:100%; }
.buy-delivery { padding:16px 0; border-top:1px solid var(--line); }
.buy-delivery form { display:flex; flex-wrap:wrap; gap:10px; align-items:end; }
@media(max-width:1040px) { .nav { grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; } .nav > [data-view=dashboard] { grid-column:1 / -1; } }
@media(max-width:640px) { .buy-intro,.buy-product-head,.buy-delivery { flex-direction:column; align-items:stretch; } .buy-intro h2 {font-size:23px;} .buy-numbers {grid-template-columns:repeat(2,minmax(0,1fr));} .buy-approval form {align-items:stretch; flex-direction:column;} }

.receipt-modal{width:min(520px,calc(100vw - 24px));max-height:94vh}.receipt-preview{max-height:62vh;overflow:auto;background:#e9eef2;padding:18px}.receipt-paper{display:none}.receipt-preview>*,#receipt-print-area{box-sizing:border-box}.receipt-preview .receipt-paper-content{width:80mm;max-width:100%;margin:auto;background:#fff;color:#111;padding:5mm 4mm;font-family:"Courier New",monospace;font-size:11px;line-height:1.3;box-shadow:0 5px 20px rgba(15,23,42,.16)}.receipt-brand{text-align:center}.receipt-brand img{width:86px;max-height:42px;object-fit:contain;filter:grayscale(1)}.receipt-paper h1,.receipt-preview h1{text-align:center;font-size:16px;margin:5px 0 2px}.receipt-paper h2,.receipt-preview h2{text-align:center;font-size:14px;margin:5px 0}.receipt-paper h3,.receipt-preview h3{font-size:11px;margin:5px 0}.receipt-paper p,.receipt-preview p{margin:2px 0;text-align:center}.receipt-rule{border-top:1px dashed #555;margin:7px 0}.receipt-non-fiscal{display:block;text-align:center;font-size:12px}.receipt-items-head,.receipt-item,.receipt-total-row,.receipt-grand-total{display:flex;justify-content:space-between;gap:8px}.receipt-items-head{font-weight:700;font-size:10px}.receipt-item{align-items:start;margin:7px 0}.receipt-item>div{min-width:0}.receipt-item small{display:block;margin-top:2px}.receipt-item>strong{white-space:nowrap}.receipt-total-row{margin:3px 0}.receipt-grand-total{font-size:16px;margin:6px 0}.receipt-thanks{font-weight:700}.receipt-actions{position:sticky;bottom:0;background:#fff;margin-bottom:0!important;padding-bottom:18px!important}
.pos-customer-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin-top:16px}.pos-customer-toolbar input{margin:0}.pos-customer-toolbar button{white-space:nowrap}.pos-quick-customer{padding:4px 0 0}.pos-quick-customer label{font-weight:750}.pos-quick-customer .pos-modal-actions{margin-left:0!important;margin-right:0!important}@media(max-width:560px){.pos-customer-toolbar{grid-template-columns:1fr}.pos-customer-toolbar button{width:100%}}
.cash-close-expected{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0}.cash-close-expected div{background:#f1f5f8;border-radius:9px;padding:10px}.cash-close-expected span{display:block;color:#64748b;font-size:11px}.cash-close-expected strong{display:block;margin-top:3px}.pos-modal form>.wide{margin:18px 0 20px}.pos-modal form textarea{width:100%;resize:vertical}

@media print{
  @page{size:80mm auto;margin:3mm}
  body *{visibility:hidden!important}
  #receipt-print-area,#receipt-print-area *{visibility:visible!important}
  #receipt-print-area{display:block!important;position:absolute;left:0;top:0;width:74mm;color:#000;background:#fff;padding:0;font-family:"Courier New",monospace;font-size:10pt;line-height:1.25}
  #receipt-print-area .receipt-brand img{filter:grayscale(1)}
}

.crm-workspace[hidden] { display:none !important; }
.crm-board-panel { min-width:0; min-height:calc(100vh - 150px); }
#crm-conversations-workspace { position:relative; }
#crm-conversations-workspace .kanban { grid-template-columns:repeat(8,minmax(235px,1fr)); padding-bottom:120px; }
#crm-conversations-workspace .lane { min-height:calc(100vh - 285px); }
.crm-detail { position:fixed; z-index:80; right:24px; bottom:24px; width:min(430px,calc(100vw - 48px)); max-height:calc(100vh - 48px); overflow:auto; border-radius:14px; box-shadow:0 22px 70px rgba(16,24,32,.28); }
.crm-detail[hidden] { display:none; }
.crm-detail .dialog-close { width:32px; height:32px; flex-basis:32px; font-size:20px; }
.crm-minimized-chats { position:fixed; z-index:79; right:470px; bottom:18px; display:flex; gap:9px; align-items:end; max-width:calc(100vw - 500px); overflow:auto; }
.crm-parked-chat { width:230px; flex:0 0 230px; padding:10px; border:1px solid #38505a; border-radius:10px; background:#173642; color:white; box-shadow:0 12px 32px rgba(16,24,32,.22); }
.crm-parked-chat>div { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.crm-parked-chat>div button { border:0; background:transparent; color:white; font-size:18px; }
.crm-parked-chat p { color:#c5d5da; font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin:7px 0; }
.crm-parked-chat .ghost { color:white; border-color:#52707b; width:100%; padding:6px; }
.crm-parked-chat span { color:#f0b84b; }
.customer-toolbar { display:flex; justify-content:space-between; gap:12px; align-items:center; margin:14px 0; }
.customer-toolbar .search { flex:1; max-width:520px; }
.customer-bi { display:grid; grid-template-columns:repeat(5,minmax(130px,1fr)); gap:10px; margin:18px 0; }
.customer-bi article { min-width:0; padding:14px; border:1px solid var(--line); border-radius:10px; background:linear-gradient(145deg,var(--surface),#f7fafb); }
.customer-bi article.attention { background:#fff9ec; border-color:#efd493; }
.customer-bi span,.customer-bi small { display:block; color:var(--muted); }
.customer-bi span { font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.customer-bi strong { display:block; margin:7px 0 4px; font-size:25px; line-height:1; }
.customer-bi small { font-size:11px; line-height:1.3; }
.customer-profile-bar { height:5px; margin-top:10px; overflow:hidden; border-radius:999px; background:#dce6e8; }
.customer-profile-bar i { display:block; height:100%; background:var(--primary); }
.customer-filter-tabs { display:inline-flex; align-items:center; gap:6px; flex-wrap:nowrap; }
.customer-filter-tabs button { min-height:38px; height:auto; width:auto; white-space:nowrap; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); padding:8px 12px; font-size:12px; font-weight:800; line-height:1.2; }
.customer-filter-tabs button.selected { color:var(--primary-dark); background:var(--soft-blue); border-color:rgba(47,127,122,.25); }
.customer-filter-tabs .nav-badge { margin-left:5px; }
.customer-follow-up-summary { display:flex; gap:10px; align-items:center; padding:11px 13px; margin-bottom:12px; border-radius:9px; background:var(--soft-blue); }
.customer-follow-up-summary span { color:var(--muted); font-size:13px; }
.customer-dialog { width:min(820px,calc(100vw - 32px)); }
.customer-dialog textarea { min-height:80px; }
.customer-status-actions { margin-top:20px; padding-top:16px; border-top:1px solid var(--line); }
.customer-status-actions summary { cursor:pointer; color:var(--muted); font-size:13px; }
.customer-status-actions p { margin:12px 0; font-size:13px; line-height:1.5; }
/* Adapt to the available panel width, including split-screen windows. */
#customers-view { container-type:inline-size; }
#customers-view .panel-head { flex-wrap:wrap; }
#customers-view .panel-head > div { flex:1 1 260px; min-width:0; }
#open-customer-register { flex-shrink:0; white-space:nowrap; }
#customers-view .customer-toolbar { flex-wrap:wrap; flex-direction:row; }
#customers-view .customer-toolbar .search { min-width:0; flex:1 1 260px; }
#customers-view .customer-filter-tabs { flex-wrap:wrap; max-width:100%; }
#customers-view .customer-filter-tabs button { white-space:normal; }
#customers-view .customer-follow-up-summary { flex-wrap:wrap; }
#customers-view .customer-bi { grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr)); }
#customers-view table { min-width:0; table-layout:fixed; }
#customer-table td { overflow-wrap:anywhere; vertical-align:middle; font-size:13px; }
#customers-view .customer-actions-cell { width:176px; }
#customers-view .row-actions, #product-table .row-actions { display:flex; flex-wrap:nowrap; gap:6px; justify-content:flex-end; }
.row-actions > .icon-action { display:inline-flex; align-items:center; justify-content:center; flex:0 0 36px; width:36px; min-width:36px; min-height:36px; height:36px; padding:0; border:1px solid transparent; }
.icon-action svg { pointer-events:none; }
.icon-action:hover { border-color:var(--primary); background:var(--soft-blue); }
.icon-action:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.icon-action.danger-button:hover { border-color:var(--danger); background:var(--soft-red); }
.customer-row-details { display:none; margin-top:5px; }
.customer-row-details summary { cursor:pointer; color:var(--primary-dark); font-size:12px; width:fit-content; }
.customer-row-details dl { display:grid; gap:3px; margin:8px 0 0; font-size:12px; }
.customer-row-details dt { font-weight:700; color:var(--muted); }
.customer-row-details dd { margin:0 0 5px; }
@container (max-width:1000px) {
  #customers-view th:nth-child(4), #customers-view th:nth-child(6), #customer-table td:nth-child(4), #customer-table td:nth-child(6) { display:none; }
  .customer-row-details { display:block; }
}
@container (max-width:760px) {
  #customers-view th:nth-child(3), #customers-view th:nth-child(5), #customer-table td:nth-child(3), #customer-table td:nth-child(5) { display:none; }
  #customers-view .customer-bi article { padding:10px; }
  #customers-view .customer-bi small { display:none; }
}
@container (max-width:480px) {
  #customers-view table, #customer-table { display:block; }
  #customers-view thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  #customer-table tr { display:grid; grid-template-columns:minmax(0,1fr) auto; padding:10px 0; border-bottom:1px solid var(--line); gap:4px 8px; }
  #customer-table td { display:block; border:0; padding:0; }
  #customer-table td:first-child { grid-column:1; grid-row:1; }
  #customer-table td:nth-child(2) { grid-column:1; grid-row:2; font-size:12px; color:var(--muted); }
  #customer-table .customer-actions-cell { grid-column:2; grid-row:1 / 3; width:auto; }
  #customers-view .row-actions { display:grid; grid-template-columns:repeat(2,36px); }
  #customers-view .customer-filter-tabs { overflow:visible; }
}

@media(max-width:1100px){.customer-bi{grid-template-columns:repeat(3,minmax(150px,1fr))}}
@media(max-width:760px){.crm-detail{right:10px;bottom:10px;width:calc(100vw - 20px)}.crm-minimized-chats{right:10px;left:10px;max-width:none}.crm-parked-chat{width:190px;flex-basis:190px}.customer-bi{grid-template-columns:1fr 1fr}.customer-toolbar{align-items:stretch;flex-direction:column}.customer-toolbar .search{max-width:none}.customer-filter-tabs{width:100%;overflow-x:auto}.customer-filter-tabs button{flex:0 0 auto}}
@media(max-width:440px){.customer-bi{grid-template-columns:1fr}}
.beta-badge{display:inline-flex;align-items:center;border-radius:999px;padding:2px 7px;background:#fff1c7;color:#7a4b00;font-size:10px;font-weight:800;letter-spacing:.06em;vertical-align:middle}
.eyebrow-line{font-size:12px;font-weight:800;letter-spacing:.08em;color:var(--muted,#64748b);margin-bottom:4px}
.intelligence-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;margin:16px 0}
.intelligence-card{border:1px solid #dfe6e4;border-radius:12px;background:#fff;padding:14px}
.intelligence-card span{display:block;color:#64748b;font-size:12px}.intelligence-card strong{display:block;color:#17202a;font-size:24px;margin-top:4px}
.intelligence-sections{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr));gap:16px}.intelligence-sections>section{min-width:0;border:1px solid #dfe6e4;border-radius:12px;padding:14px;background:#fff}
.opportunity-list{display:grid;gap:9px}.opportunity{border-left:4px solid #2f7f7a;background:#f5faf9;border-radius:8px;padding:10px}.opportunity strong,.opportunity small{display:block}.opportunity small{color:#64748b;margin-top:4px;line-height:1.35}
.beta-note{border-radius:10px;background:#fff8e6;color:#6f4d00;padding:10px 12px;margin:12px 0}.wide-dialog{width:min(960px,calc(100vw - 32px));max-height:90vh;overflow:auto}
.link-button{border:0;background:transparent;color:#236762;font:inherit;font-weight:700;padding:0;cursor:pointer;text-align:left}
 .finance-registers{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}.finance-register{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:18px;text-align:left}.stats article small{display:block;margin-top:8px;line-height:1.5}

/* Stock consultation: search first, contextual selection actions. */
#products-view .panel-head{gap:20px;align-items:center;flex-wrap:wrap;margin-bottom:20px}
.stock-consult-search{display:flex;align-items:center;gap:8px;flex:1 1 280px;min-width:220px}
#products-view #product-search{width:100%;min-width:0;max-width:none}
.stock-refresh{font-size:23px;line-height:1;padding:10px 12px;flex-shrink:0}
#products-view .stock-consult-tools{display:flex;flex:0 0 auto;gap:8px;flex-wrap:wrap}
#products-view .stock-consult-tools button{white-space:nowrap}
#stock-selection-bar{display:flex;flex-wrap:wrap;gap:12px;align-items:center;padding:12px 14px}
#stock-selection-bar[hidden]{display:none}
#selected-products-count{font-size:12px;font-weight:600;color:var(--muted)}
#stock-selection-bar>button{flex:0 0 auto}
.stock-more-actions{position:relative;margin-left:auto}
.stock-more-actions>summary{cursor:pointer;padding:10px 12px;font-size:13px;border-radius:6px;list-style:none;background:#edf2f6}
.stock-more-actions>summary::after{content:' ▾'}
.stock-more-actions>div{position:absolute;right:0;top:calc(100% + 6px);z-index:10;background:white;padding:8px;border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px #182d321a;min-width:190px}
.stock-more-actions button{width:100%;white-space:nowrap}
@media(max-width:700px){#products-view .stock-consult-tools{width:100%}#products-view .stock-consult-tools .primary{margin-left:auto}#products-view .panel-head{gap:12px}.stock-consult-search{flex-basis:100%}}
.sidebar-footer{margin-top:auto;padding-top:16px;border-top:1px solid #ffffff26}.sidebar-footer #logout-btn{width:100%;text-align:left;background:#ffffff0c;color:#fff;padding:12px 14px}.sidebar-footer #logout-btn:hover{background:#ffffff1a}
#refresh-btn[hidden]{display:none}.stock-update-settings{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:-4px 0 16px;color:var(--muted);font-size:11px}.stock-update-settings label{display:flex;gap:8px;align-items:center}.stock-update-settings select{padding:5px 8px;font-size:11px;width:auto;border:1px solid var(--line);border-radius:6px;background:#fff}

/* Keep the map workspace inside the viewport; long controls scroll locally. */
body.layout-map-mode { overflow: hidden; }
body.layout-map-mode .app-shell { height: 100dvh; min-height: 0; align-items: stretch; }
body.layout-map-mode .main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body.layout-map-mode .topbar,
body.layout-map-mode .demo-banner { flex-shrink: 0; }
#layout-map-view.active { display: flex; flex: 1; min-height: 0; }
#layout-map-view .layout-editor-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; margin: 0; }
#layout-map-view .layout-editor-head { flex-shrink: 0; flex-wrap: wrap; gap: 10px; }
#layout-map-view .layout-editor { flex: 1; min-height: 0; grid-template-columns: 210px minmax(0, 1fr) 270px; grid-template-rows: minmax(0, 1fr); }
#layout-map-view .layout-palette,
#layout-map-view .layout-detail-panel { min-height: 0; min-width: 0; overflow: auto; }
#layout-map-view .layout-canvas-wrap { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#layout-map-view .layout-canvas-toolbar { flex-shrink: 0; }
.layout-canvas-stage { flex: 1; min-height: 0; min-width: 0; container-type: size; display: grid; place-items: center; }
#layout-map-view .store-floor { min-height: 0; width: min(100cqw, calc(100cqh * var(--floor-ratio, 1))); max-height: 100%; }
@media (max-width: 1180px) {
  #layout-map-view .layout-editor { grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 110px); }
}
@media (max-width: 1040px) {
  body.layout-map-mode .app-shell { grid-template-rows: auto minmax(0, 1fr); }
  body.layout-map-mode .sidebar { max-height: 22dvh; min-height: 0; overflow: auto; }
}
@media (max-width: 760px) {
  #layout-map-view .layout-editor { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 90px) minmax(0, 1fr) minmax(0, 80px); }
  #layout-map-view .layout-palette,
  #layout-map-view .layout-detail-panel { padding: 10px; }
  #layout-map-view .layout-editor-head { padding: 10px; }
}

/* Short references on the floor connect to full names in the legend. */
#layout-map-view .editable-zone { padding: 4px; overflow: visible; }
#layout-map-view .editable-zone strong { width: max-content; max-width: 100%; font-size: 10px; padding: 2px 4px; border-radius: 4px; background: #ffffffe6; overflow: hidden; }
#layout-map-view .editable-zone i { display: none; }
#layout-map-view .editable-zone.selected i { display: block; }
#layout-map-view .floor-gondola { min-width: 0; min-height: 0; padding: 0; border-width: 1px; border-radius: 3px; box-shadow: 0 2px 4px #1d2c4220; }
#layout-map-view .floor-gondola span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; padding: 0 2px; }
#layout-map-view .layout-detail-panel > .panel-head { flex-wrap: wrap; gap: 6px; }
.layout-legend-group { margin-top: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.layout-legend-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; text-align: left; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--text); }
.layout-legend-item:hover { background: var(--soft-blue); border-color: var(--primary); }
.layout-legend-item > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.layout-legend-item small { display: block; margin-top: 3px; color: var(--muted); }
.layout-legend-code { flex-shrink: 0; padding: 4px 6px; border-radius: 4px; font-size: 11px; background: #e4eae8; color: var(--primary-dark); }
.layout-legend-code.gondola { background: #eef1f5; color: #172b4d; }
.layout-legend-access { display: flex; align-items: center; gap: 7px; padding: 6px 0; font-size: 12px; color: var(--muted); }
#layout-environment-modal { max-height: 90dvh; overflow: auto; }
.map-planogram { padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.map-planogram-head { display: grid; gap: 5px; margin-bottom: 12px; }
.map-planogram-head small { color: var(--muted); font-size: 11px; }
.map-planogram-scroll { overflow-x: auto; padding-bottom: 4px; }
.map-planogram-level { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; width: max-content; min-width: 100%; }
.map-planogram-level-label { flex: 0 0 20px; color: var(--muted); font-size: 10px; font-weight: 700; }
.map-planogram-shelf { flex: 1; display: grid; grid-template-columns: repeat(var(--planogram-columns), minmax(58px, 1fr)); gap: 3px; padding: 3px 3px 5px; border-bottom: 4px solid #8592a5; background: #eef1f5; }
.map-planogram-slot { min-width: 0; min-height: 70px; display: flex; flex-direction: column; gap: 6px; padding: 5px; text-align: center; border: 1px dashed #c4ccd6; background: #fff; color: var(--muted); border-radius: 4px; }
.map-planogram-slot.filled { border: 1px solid #99c7bf; background: #e8f3f1; color: var(--text); }
.map-planogram-slot:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.map-planogram-slot small { font-size: 8px; color: var(--muted); }
.map-planogram-slot span { font-size: 10px; line-height: 1.3; overflow-wrap: anywhere; }
.map-planogram-key { display: flex; gap: 12px; font-size: 10px; color: var(--muted); margin: 8px 0; }
.map-planogram-key span { display: flex; align-items: center; gap: 4px; }
.layout-dot.empty { background: #eef1f5; border: 1px solid #c4ccd6; }
/* Top view: shelf modules and a central spine, with the frontal planogram in details. */
#layout-map-view .floor-gondola {
  border-color: #728598;
  background-image: linear-gradient(180deg, transparent 43%, #728598 43% 57%, transparent 57%), repeating-linear-gradient(90deg, #e8edf2 0, #e8edf2 calc(100% / var(--gondola-modules, 3) - 1px), #9baaba calc(100% / var(--gondola-modules, 3) - 1px), #9baaba calc(100% / var(--gondola-modules, 3)));
}
#layout-map-view .floor-gondola.selected { border-color: var(--primary); box-shadow: 0 0 0 3px #2f7f7a40; }
.layout-rotation-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.layout-rotation-controls button { flex: 1; white-space: nowrap; }
.layout-rotation-controls small { width: 100%; color: var(--muted); }
