:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #66756f;
  --line: #dbe4e0;
  --paper: #f3f7f5;
  --panel: #ffffff;
  --brand: #155d49;
  --brand-strong: #103e33;
  --brand-soft: #e2f5ed;
  --accent: #31bd88;
  --blue: #2468ad;
  --blue-soft: #e7f1fd;
  --orange: #a86216;
  --orange-soft: #fff0d9;
  --red: #bd3e38;
  --red-soft: #ffe7e4;
  --shadow: 0 18px 50px rgba(19, 50, 41, .09);
  --radius: 14px;
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

body.modal-open { overflow: hidden; }

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

button { color: inherit; }

button,
a,
input,
select,
textarea { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(36, 104, 173, .28);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

h1,
h2,
h3,
h4,
p { margin-top: 0; }

h1 { margin-bottom: 4px; font-size: clamp(25px, 3vw, 34px); line-height: 1.13; }
h2 { margin-bottom: 5px; font-size: 20px; line-height: 1.2; }
h3 { margin-bottom: 4px; font-size: 16px; }
p { color: var(--muted); }

.noscript {
  position: fixed;
  inset: 0 0 auto;
  z-index: 999;
  padding: 12px;
  color: #fff;
  background: var(--red);
  text-align: center;
  font-weight: 800;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand > span:last-child { display: grid; min-width: 0; }
.brand strong { font-size: 17px; }
.brand small { overflow: hidden; color: #b9cbc4; text-overflow: ellipsis; white-space: nowrap; }
.brand-dark small { color: var(--muted); }

.brand-mark {
  position: relative;
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: 0 10px 24px rgba(17, 73, 58, .2);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: .04em;
}

.brand-mark::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 13px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.eyebrow {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow.light { color: #9ae6c9; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(390px, .84fr) minmax(440px, 1.16fr);
  background: #fff;
}

.auth-card {
  display: grid;
  align-content: center;
  gap: 24px;
  padding: clamp(28px, 5vw, 68px);
  border-right: 1px solid var(--line);
}

.auth-card > * { width: min(100%, 520px); margin-inline: auto; }
.auth-heading h1 { font-size: clamp(31px, 4.3vw, 47px); }
.auth-heading p { margin: 8px 0 0; font-size: 16px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 12px;
  background: #edf3f0;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.auth-tab.active {
  color: var(--brand-strong);
  background: #fff;
  box-shadow: 0 4px 14px rgba(21, 60, 49, .09);
}

.auth-showcase {
  position: relative;
  display: grid;
  align-content: center;
  gap: 36px;
  overflow: hidden;
  padding: clamp(35px, 7vw, 100px);
  color: #fff;
  background:
    radial-gradient(circle at 80% 12%, rgba(49, 189, 136, .32), transparent 28%),
    radial-gradient(circle at 6% 88%, rgba(68, 127, 191, .2), transparent 33%),
    linear-gradient(145deg, #123d34, #102b27 72%);
}

.auth-showcase::after {
  position: absolute;
  right: -110px;
  bottom: -110px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 52px rgba(255, 255, 255, .025), 0 0 0 104px rgba(255, 255, 255, .02);
  content: "";
}

.showcase-copy,
.showcase-grid { position: relative; z-index: 1; }
.showcase-copy { max-width: 720px; }
.showcase-copy h2 { max-width: 650px; margin-bottom: 14px; font-size: clamp(33px, 4.6vw, 58px); letter-spacing: -.03em; }
.showcase-copy p { max-width: 610px; margin: 0; color: #c6d8d2; font-size: 17px; }

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

.showcase-grid article {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  background: rgba(255, 255, 255, .065);
  backdrop-filter: blur(8px);
}

.showcase-grid small { color: #c6d8d2; }
.feature-icon { font-size: 22px; }

.form-stack { display: grid; gap: 15px; }
.field { min-width: 0; }
.field-grid { display: grid; gap: 12px; }
.field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.field label,
.field-label {
  display: block;
  margin-bottom: 6px;
  color: #4e5f59;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfdad5;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input,
select { padding: 0 12px; }
textarea { min-height: 90px; padding: 10px 12px; resize: vertical; }
input::placeholder,
textarea::placeholder { color: #93a29c; }
input:focus,
select:focus,
textarea:focus { border-color: #5ba88c; box-shadow: 0 0 0 3px rgba(49, 189, 136, .11); outline: 0; }
input:disabled,
select:disabled,
textarea:disabled { cursor: not-allowed; opacity: .65; background: #f2f5f4; }

.password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #4c5c56;
  cursor: pointer;
  font-size: 13px;
}

.check-row input { width: 18px; min-height: 18px; flex: 0 0 auto; margin: 1px 0 0; }

.button,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 850;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  white-space: nowrap;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled,
.icon-button:disabled { cursor: not-allowed; opacity: .55; }
.button.wide { width: 100%; }
.button.small { min-height: 34px; padding: 0 10px; font-size: 12px; }
.button.primary { color: #fff; border-color: var(--brand); background: var(--brand); box-shadow: 0 8px 18px rgba(21, 93, 73, .15); }
.button.primary:hover:not(:disabled) { background: #104f3e; }
.button.secondary { color: #24443a; border-color: #cad9d3; background: #fff; }
.button.ghost { color: #d9e8e2; border-color: rgba(255, 255, 255, .13); background: rgba(255, 255, 255, .06); }
.button.danger { color: var(--red); border-color: #efc0bc; background: #fff7f6; }
.button.danger.solid { color: #fff; border-color: var(--red); background: var(--red); }
.button.warning { color: #87500f; border-color: #f1d19d; background: var(--orange-soft); }

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border-color: #d3ded9;
  border-radius: 10px;
  background: #fff;
}

.form-message:empty,
.workspace-message:empty { display: none; }

.form-message,
.workspace-message,
.inline-message {
  padding: 11px 12px;
  border: 1px solid #bde7d6;
  border-radius: 10px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 750;
}

.form-message.error,
.workspace-message.error,
.inline-message.error { color: var(--red); border-color: #efbcb7; background: var(--red-soft); }
.inline-message.warning { color: #7d4b11; border-color: #edd19d; background: var(--orange-soft); }

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  overflow-y: auto;
  padding: 20px 14px 16px;
  color: #fff;
  background: linear-gradient(180deg, #123a33, #102923);
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px; }
.primary-nav { display: grid; align-content: start; gap: 5px; }
.primary-nav button {
  display: grid;
  min-height: 44px;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 0;
  border-radius: 10px;
  color: #d6e4df;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.primary-nav button span { color: #91b7a8; font-size: 18px; text-align: center; }
.primary-nav button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.primary-nav button.active { color: #fff; background: #28564a; box-shadow: inset 3px 0 0 var(--accent); }

.sidebar-foot { display: grid; gap: 12px; }
.signed-user { display: grid; min-width: 0; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
.signed-user > span:last-child { display: grid; min-width: 0; }
.signed-user strong,
.signed-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signed-user small { color: #9fb7af; }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--brand-strong); background: #bfead8; font-size: 12px; font-weight: 950; }

.workspace { min-width: 0; padding: 24px clamp(16px, 3vw, 34px) 42px; }
.workspace-head { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.workspace-title { display: flex; min-width: 0; align-items: center; gap: 10px; }
.workspace-title h1 { overflow-wrap: anywhere; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }
.workspace-message { margin-bottom: 15px; }
.view-root { min-width: 0; }

.connection-pill,
.status-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.connection-pill { min-height: 34px; padding: 0 11px; }
.connection-pill::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.connection-pill.online { color: var(--brand); background: var(--brand-soft); }
.connection-pill.offline { color: var(--red); background: var(--red-soft); }
.status-badge { padding: 6px 9px; }
.status-badge.green { color: var(--brand); background: var(--brand-soft); }
.status-badge.blue { color: var(--blue); background: var(--blue-soft); }
.status-badge.orange { color: var(--orange); background: var(--orange-soft); }
.status-badge.red { color: var(--red); background: var(--red-soft); }
.status-badge.gray { color: #596760; background: #edf1ef; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 15px;
}

.metric-card,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card { display: grid; align-content: space-between; gap: 16px; min-height: 125px; padding: 17px; }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 750; }
.metric-card strong { overflow-wrap: anywhere; font-size: clamp(23px, 3vw, 32px); line-height: 1.08; }
.metric-card small { color: #82908b; }
.metric-card.accent { color: #fff; border-color: transparent; background: linear-gradient(145deg, var(--brand), #174a3d); }
.metric-card.accent span,
.metric-card.accent small { color: #c5e1d6; }

.layout-grid { display: grid; min-width: 0; gap: 15px; }
.layout-grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(290px, .8fr); }
.layout-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel { overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 17px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 4px 0 0; font-size: 12px; }
.panel-actions,
.toolbar-actions,
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.panel-body { min-width: 0; padding: 17px; }
.panel-body.flush { padding: 0; }

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.toolbar-fields { display: flex; min-width: 0; align-items: flex-end; flex: 1; flex-wrap: wrap; gap: 9px; }
.toolbar .field { min-width: 150px; }
.toolbar .search-field { min-width: min(100%, 290px); flex: 1; }

.empty-state,
.loading-state,
.error-state { display: grid; min-height: 230px; place-content: center; justify-items: center; gap: 10px; padding: 26px; color: var(--muted); text-align: center; }
.empty-state strong,
.loading-state strong { color: var(--ink); font-size: 16px; }
.empty-icon { font-size: 34px; }
.spinner { width: 30px; height: 30px; border: 3px solid #d9e5e0; border-top-color: var(--brand); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th,
.data-table td { padding: 11px 10px; border-bottom: 1px solid #e5ece9; text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); background: #fafcfb; font-size: 10px; font-weight: 900; letter-spacing: .045em; text-transform: uppercase; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-action] { cursor: pointer; }
.data-table tbody tr[data-action]:hover { background: #f7fbf9; }
.cell-title { display: grid; min-width: 150px; gap: 2px; }
.cell-title small { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 850; white-space: nowrap; }
.negative { color: var(--red); }
.positive { color: var(--brand); }

.checkout-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); align-items: start; gap: 15px; }
.checkout-main { display: grid; min-width: 0; gap: 13px; }
.sale-channel-tabs { display: flex; gap: 7px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sale-channel-tabs button { min-height: 39px; flex: 1; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 850; }
.sale-channel-tabs button.active { color: #fff; background: var(--brand); }
.scanner-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 14px; border: 1px solid #aad9c5; border-radius: 13px; background: linear-gradient(120deg, #f2fcf8, #fff); box-shadow: 0 0 0 4px rgba(49, 189, 136, .06); }
.scanner-box input { min-height: 50px; border-width: 2px; font-size: 17px; font-weight: 800; }
.scanner-hint { grid-column: 1 / -1; margin: 0; color: #577068; font-size: 11px; }
.product-search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 9px; }
.product-tile { display: grid; min-width: 0; min-height: 126px; align-content: space-between; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: left; }
.product-tile:hover { border-color: #89c7ae; box-shadow: 0 8px 22px rgba(21, 93, 73, .09); }
.product-tile:disabled { cursor: not-allowed; opacity: .55; }
.product-tile h3 { overflow-wrap: anywhere; }
.product-tile small { color: var(--muted); }
.product-tile footer { display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.stock-text.low { color: var(--orange); }
.stock-text.out { color: var(--red); }

.cart-panel { position: sticky; top: 18px; }
.cart-list { display: grid; max-height: min(45vh, 480px); gap: 8px; overflow-y: auto; padding-right: 3px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; padding: 10px; border: 1px solid #e0e8e4; border-radius: 10px; background: #fff; }
.cart-line-copy { min-width: 0; }
.cart-line-copy strong { display: block; overflow-wrap: anywhere; }
.cart-line-copy small { color: var(--muted); }
.cart-line-total { text-align: right; }
.quantity-control { display: grid; width: 116px; grid-template-columns: 34px 44px 34px; gap: 2px; margin-top: 8px; }
.quantity-control button { min-height: 32px; border: 1px solid var(--line); background: #f6f9f7; cursor: pointer; }
.quantity-control input { min-height: 32px; padding: 0 3px; text-align: center; }
.cart-remove { margin-top: 8px; border: 0; color: var(--red); background: transparent; cursor: pointer; font-size: 11px; font-weight: 850; }
.cart-totals { display: grid; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.total-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.total-row.grand { padding-top: 8px; border-top: 2px solid #dce5e1; font-size: 20px; }
.total-row.balance { color: var(--red); }
.payment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.payment-choice { display: grid; min-width: 0; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.payment-choice.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px rgba(21, 93, 73, .08); }
.payment-choice small { color: var(--muted); }
.checkout-actions { display: grid; gap: 8px; margin-top: 13px; }

.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 11px; }
.table-card { position: relative; display: grid; min-height: 155px; align-content: space-between; gap: 12px; padding: 15px; border: 1px solid var(--line); border-top: 5px solid #a9b6b0; border-radius: 13px; background: #fff; cursor: pointer; text-align: left; }
.table-card.free { border-top-color: var(--accent); }
.table-card.open { border-top-color: var(--blue); }
.table-card.deposit { border-top-color: #e59c37; }
.table-card.paid { border-top-color: var(--brand); }
.table-card strong { font-size: 18px; }
.table-card .table-total { font-size: 23px; font-weight: 900; }
.table-card small { color: var(--muted); }

.customer-grid { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.25fr); align-items: start; gap: 15px; }
.list-stack { display: grid; gap: 8px; }
.list-card { display: grid; min-width: 0; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; text-align: left; }
.list-card:hover,
.list-card.active { border-color: #7fc2a8; background: #f5fcf9; }
.list-card small { color: var(--muted); }
.address-card { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }

.product-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-form-grid .full { grid-column: 1 / -1; }
.stock-adjustment { padding: 12px; border: 1px solid #e8d3ac; border-radius: 11px; background: #fff8eb; }

.chart { display: grid; gap: 9px; }
.chart-row { display: grid; grid-template-columns: minmax(90px, 150px) minmax(90px, 1fr) auto; align-items: center; gap: 9px; }
.chart-label { overflow: hidden; color: #44564f; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { height: 11px; overflow: hidden; border-radius: 999px; background: #eaf0ed; }
.chart-bar { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.chart-bar.blue { background: linear-gradient(90deg, #326ca9, #73b3f2); }
.chart-value { min-width: 62px; font-size: 11px; font-weight: 850; text-align: right; }
.daily-chart { display: flex; height: 220px; align-items: end; gap: 8px; overflow-x: auto; padding: 12px 4px 0; border-bottom: 1px solid var(--line); }
.daily-column { display: grid; min-width: 44px; height: 100%; flex: 1 0 44px; grid-template-rows: 1fr auto; align-items: end; gap: 5px; }
.daily-column-bar { width: 66%; min-height: 3px; margin-inline: auto; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--accent), var(--brand)); }
.daily-column small { overflow: hidden; color: var(--muted); font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.permission-groups { display: grid; gap: 14px; }
.permission-group { padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
.permission-group h3 { margin-bottom: 10px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.permission-grid .check-row { padding: 8px; border-radius: 8px; background: #f7faf8; }
.sensitive-note { padding: 11px; border-left: 4px solid var(--orange); border-radius: 8px; color: #714511; background: var(--orange-soft); font-size: 12px; }

.logo-preview { display: grid; width: 132px; height: 96px; place-items: center; overflow: hidden; border: 1px dashed #bdccc6; border-radius: 11px; color: var(--muted); background: #f8faf9; }
.logo-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.settings-section { display: grid; gap: 13px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.settings-section:first-child { padding-top: 0; }
.settings-section:last-child { border-bottom: 0; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; }
.pagination small { color: var(--muted); }

.toast-region { position: fixed; top: 16px; right: 16px; z-index: 200; display: grid; width: min(390px, calc(100vw - 32px)); gap: 8px; pointer-events: none; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 9px; padding: 12px; border: 1px solid #b9dfd0; border-radius: 12px; color: #154b3c; background: #f0fbf7; box-shadow: 0 16px 45px rgba(20, 53, 43, .18); pointer-events: auto; }
.toast.error { color: var(--red); border-color: #edb5b0; background: #fff1ef; }
.toast.warning { color: #815015; border-color: #ead09e; background: #fff8e9; }
.toast button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 18px; }

.dialog { width: min(760px, calc(100vw - 24px)); max-height: min(90vh, 900px); padding: 0; border: 0; border-radius: 16px; background: transparent; box-shadow: 0 30px 90px rgba(11, 33, 27, .32); }
.dialog::backdrop { background: rgba(10, 25, 21, .62); backdrop-filter: blur(2px); }
.compact-dialog { width: min(510px, calc(100vw - 24px)); }
.dialog-card { display: grid; max-height: min(90vh, 900px); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid #d5dfdb; border-radius: 16px; background: #fff; }
.dialog-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px; border-bottom: 1px solid var(--line); }
.dialog-body { overflow-y: auto; padding: 17px; }
.dialog-card > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 17px; border-top: 1px solid var(--line); background: #fafcfb; }

.nav-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(9, 29, 23, .5); }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkout-layout { grid-template-columns: minmax(0, 1fr) minmax(310px, .7fr); }
  .layout-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 940px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-card { min-height: 100vh; border-right: 0; }
  .auth-showcase { display: none; }

  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(var(--sidebar-width), calc(100vw - 56px)); box-shadow: 20px 0 60px rgba(8, 31, 24, .25); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .sidebar .mobile-only { color: #fff; border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); }
  .workspace { padding-top: 16px; }
  .checkout-layout,
  .customer-grid { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
  .layout-grid.two,
  .layout-grid.equal { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .auth-card { align-content: start; gap: 20px; padding: 24px 18px 40px; }
  .auth-heading h1 { font-size: 33px; }
  .field-grid.two-columns,
  .field-grid.three-columns,
  .field-grid.four-columns,
  .product-form-grid,
  .permission-grid { grid-template-columns: 1fr; }
  .product-form-grid .full { grid-column: auto; }
  .workspace { padding: 14px 12px 32px; }
  .workspace-head { align-items: flex-start; }
  .workspace-actions .connection-pill { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 106px; padding: 13px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-fields { display: grid; grid-template-columns: 1fr; }
  .toolbar .field,
  .toolbar .search-field { min-width: 0; width: 100%; }
  .toolbar-actions .button { flex: 1; }
  .layout-grid.three { grid-template-columns: 1fr; }
  .product-search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { align-items: stretch; flex-direction: column; }
  .panel-actions .button { flex: 1; }
  .chart-row { grid-template-columns: minmax(75px, 110px) minmax(70px, 1fr) auto; }
  .dialog { width: calc(100vw - 12px); }
  .dialog-card { max-height: calc(100vh - 12px); border-radius: 13px; }
}

@media (max-width: 460px) {
  .auth-tabs { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 96px; }
  .workspace-actions .button { min-width: 43px; overflow: hidden; padding: 0 9px; font-size: 0; }
  .workspace-actions .button::after { content: "↻"; font-size: 19px; }
  .scanner-box { grid-template-columns: 1fr; }
  .scanner-hint { grid-column: auto; }
  .product-search-results,
  .table-grid,
  .payment-grid { grid-template-columns: 1fr; }
  .sale-channel-tabs { overflow-x: auto; }
  .sale-channel-tabs button { min-width: 105px; }
  .cart-line { grid-template-columns: 1fr; }
  .cart-line-total { text-align: left; }
  .dialog-card > footer { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Recibo térmico independiente. */
.receipt-page { min-height: 100vh; margin: 0; background: #e8eeeb; color: #0e1714; }
.receipt-toolbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px max(18px, calc((100vw - 920px) / 2)); border-bottom: 1px solid #ced9d4; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 26px rgba(8, 31, 24, .08); }
.receipt-toolbar > div:first-child { display: grid; gap: 2px; }
.receipt-toolbar small { color: var(--muted); }
.receipt-stage { display: grid; justify-items: center; padding: 32px 14px 70px; }
.receipt-loading { display: grid; justify-items: center; gap: 12px; padding: 50px; }
.receipt-error { width: min(520px, 100%); padding: 22px; border-color: #f3b5ad; color: #8d251a; }
.receipt-paper { --paper-width: 72mm; width: var(--paper-width); min-height: 90mm; box-sizing: border-box; padding: 5mm 4mm 7mm; overflow-wrap: anywhere; background: #fff; color: #000; font-family: "Courier New", ui-monospace, monospace; font-size: 11px; line-height: 1.32; box-shadow: 0 18px 50px rgba(8, 31, 24, .2); }
.receipt-paper.receipt-58 { --paper-width: 48mm; padding-inline: 2.5mm; font-size: 9.5px; }
.receipt-head { display: grid; justify-items: center; gap: 3px; text-align: center; }
.receipt-head h1 { margin: 2px 0 0; font: 700 1.45em/1.1 "Courier New", ui-monospace, monospace; }
.receipt-head p,
.receipt-foot p { margin: 2px 0; white-space: pre-line; }
.receipt-logo { display: block; width: auto; max-width: 70%; height: auto; max-height: 18mm; object-fit: contain; }
.receipt-rule { margin: 8px 0; border-top: 1px dashed #000; }
.receipt-meta { display: grid; gap: 3px; }
.receipt-meta > div,
.receipt-payments > div,
.receipt-total-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt-meta span { flex: 0 0 auto; }
.receipt-meta b { text-align: right; }
.receipt-items { display: grid; gap: 5px; }
.receipt-item { display: grid; grid-template-columns: minmax(0, 1fr) 34px 66px; gap: 5px; align-items: start; }
.receipt-58 .receipt-item { grid-template-columns: minmax(0, 1fr) 24px 52px; }
.receipt-item > :nth-child(2),
.receipt-item > :nth-child(3) { text-align: right; }
.receipt-item small { display: block; margin-top: 1px; font-size: .9em; }
.receipt-item-head { padding-bottom: 3px; border-bottom: 1px solid #000; font-weight: 700; }
.receipt-totals { display: grid; gap: 3px; }
.receipt-total-row.strong { margin-top: 2px; font-size: 1.16em; }
.receipt-payments { display: grid; gap: 3px; margin-top: 10px; }
.receipt-payments h2 { margin: 0 0 2px; font: 700 1em/1.2 "Courier New", ui-monospace, monospace; text-transform: uppercase; }
.receipt-foot { display: grid; justify-items: center; gap: 4px; margin-top: 13px; text-align: center; }
.receipt-void { margin: 8px 0; padding: 5px; border: 2px solid #000; font-weight: 700; text-align: center; }

@media (max-width: 520px) {
  .receipt-toolbar { align-items: stretch; flex-direction: column; }
  .receipt-toolbar .panel-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .receipt-stage { padding: 16px 4px 44px; overflow-x: auto; }
}

@media print {
  @page { size: auto; margin: 0; }
  .receipt-page { min-height: 0; background: #fff; }
  .receipt-toolbar,
  .receipt-loading,
  .receipt-error { display: none !important; }
  .receipt-stage { display: block; padding: 0; }
  .receipt-paper { width: var(--paper-width); min-height: 0; margin: 0; box-shadow: none; }
}
