:root {
  --bg: #f4f6f2;
  --app-background: #f4f6f2;
  --panel: #ffffff;
  --theme-surface-soft: #ffffff;
  --text: #000000;
  --muted: #000000;
  --line: #dfe5dc;
  --accent: #1f8a70;
  --accent-strong: #126b56;
  --danger: #b42318;
  --warning: #b7791f;
  --shadow: 0 20px 50px rgba(26, 39, 33, 0.12);
  --control-height: 42px;
  --dialog-padding: 20px;
  --dialog-gap: 18px;
  --app-scale: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: calc(100vh / var(--app-scale));
  color: var(--text);
  background: var(--app-background);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (min-width: 1100px) {
  :root {
    --app-scale: 0.78;
  }

  body {
    zoom: var(--app-scale);
  }
}

@media (max-width: 1099px) {
  body {
    zoom: 1;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: calc(100vh / var(--app-scale));
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 82px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(280px, 1.2fr) auto;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand h1,
.brand p,
.invoice-head h2,
.dialog-head h2 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.business-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  text-align: center;
}

.business-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.business-identity p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.brand p,
.inventory-meta span,
.receipt-muted {
  color: var(--muted);
}

.top-actions,
.checkout-actions,
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  align-items: center;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
  min-height: var(--control-height);
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 12px;
  font-weight: 800;
  font-size: 14px;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  color: #000;
  background: #e8f4ef;
  border-color: #c7e3d8;
}

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

.danger-button {
  color: #fff;
  background: var(--danger);
}

.hidden {
  display: none !important;
}

.top-actions-menu {
  position: relative;
}

.top-actions-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.top-actions-menu summary::-webkit-details-marker {
  display: none;
}

.top-actions-menu summary::after {
  content: "▾";
  font-size: 12px;
}

.top-actions-menu[open] summary::after {
  content: "▴";
}

.top-actions-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 210px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(17, 33, 59, 0.14);
}

.top-actions-menu-panel button {
  width: 100%;
  justify-content: flex-start;
}

.auth-screen {
  min-height: calc(100vh / var(--app-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 72px);
  background:
    radial-gradient(circle at 12% 12%, rgba(52, 211, 153, 0.16), transparent 29%),
    radial-gradient(circle at 88% 84%, rgba(31, 138, 112, 0.13), transparent 34%),
    linear-gradient(135deg, #edf5f1 0%, #f8faf9 48%, #e6f0eb 100%);
}

.auth-layout {
  width: min(1180px, 100%);
  min-height: min(720px, calc((100vh - 64px) / var(--app-scale)));
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(390px, 0.78fr);
  overflow: hidden;
  border: 1px solid rgba(24, 79, 61, 0.13);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 80px rgba(19, 55, 42, 0.17);
}

.auth-showcase {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 34px;
  overflow: hidden;
  padding: clamp(42px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 84% 16%, rgba(129, 230, 185, 0.24), transparent 28%),
    linear-gradient(145deg, #0d6b57 0%, #145744 58%, #103f34 100%);
}

.auth-showcase::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -115px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 0 0 42px rgba(255, 255, 255, 0.035),
    0 0 0 86px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  display: grid;
  justify-items: start;
  gap: 12px;
  text-align: left;
}

.auth-brand .brand-mark {
  width: clamp(140px, 14vw, 190px);
  height: clamp(140px, 14vw, 190px);
  margin-bottom: 8px;
  border: 6px solid rgba(255, 255, 255, 0.92);
  border-radius: 30px;
  box-shadow: 0 24px 55px rgba(3, 31, 24, 0.28);
}

.auth-brand h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(46px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: -2px;
}

.auth-brand p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.6;
}

.auth-brand .auth-kicker {
  color: #a9f0d2;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.auth-highlights {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.auth-highlights article {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.auth-highlights span {
  color: #a9f0d2;
  font-size: 11px;
  font-weight: 900;
}

.auth-highlights strong {
  font-size: 14px;
}

.auth-highlights small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.4;
}

.auth-showcase-note {
  position: relative;
  z-index: 1;
  margin: -18px 0 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 700;
}

.auth-access {
  display: grid;
  place-items: center;
  padding: clamp(34px, 5vw, 70px);
  background:
    radial-gradient(circle at top right, rgba(31, 138, 112, 0.09), transparent 34%),
    #fff;
}

.auth-card {
  width: min(410px, 100%);
  display: grid;
  gap: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.auth-card-head p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-card .eyebrow {
  color: var(--accent-strong);
  letter-spacing: 1px;
}

.auth-card .auth-form {
  gap: 17px;
}

.auth-card input {
  min-height: 52px;
  border-radius: 12px;
  background: #fbfdfc;
}

.auth-submit {
  min-height: 52px;
  margin-top: 3px;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(31, 138, 112, 0.19);
}

.login-lockout {
  margin: -4px 0 0;
  padding: 12px 14px;
  color: #7f1d1d;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.auth-form.is-locked input,
.auth-form.is-locked .password-toggle,
.auth-form.is-locked .auth-submit {
  cursor: not-allowed;
  opacity: 0.62;
}

.auth-support {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d7e9e0;
  border-radius: 12px;
  background: #f2f9f5;
}

.auth-support span {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.auth-support p {
  margin: 0;
  color: #315746;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.theme-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.theme-preview-swatch {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 33, 28, 0.14);
  border-radius: 7px;
  background: var(--theme-preview-color, var(--bg));
}

.auth-card-head {
  display: grid;
  gap: 4px;
}

.auth-card-head h2 {
  margin: 0;
  font-size: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.auth-tab.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.user-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.user-list h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.user-row div {
  display: grid;
  gap: 3px;
}

.user-row span,
.user-row small {
  color: var(--muted);
  font-size: 12px;
}

.user-row .status-active,
.user-row .status-suspended {
  font-weight: 800;
}

.user-row .status-active {
  color: var(--accent-strong);
}

.user-row .status-suspended {
  color: var(--danger);
}

.status-active,
.status-suspended,
.status-pending {
  font-weight: 800;
}

.status-active {
  color: var(--accent-strong);
}

.status-suspended {
  color: var(--danger);
}

.status-pending {
  color: var(--warning);
}

.user-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.user-row-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.user-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  background: #f7faf6;
  border-color: var(--line);
}

.pos-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  height: calc((100vh - 128px) / var(--app-scale));
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.super-dashboard {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
}

.super-hero,
.super-users {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.super-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
}

.super-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.super-users .super-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  justify-content: start;
  gap: 14px;
}

.super-users .user-row {
  min-height: 232px;
  display: grid;
  grid-template-rows: 1fr auto;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  background: var(--theme-surface-soft);
}

.super-users .user-row-actions {
  justify-content: stretch;
}

.super-users .user-row-actions small { grid-column: 1 / -1; }

.super-users .user-row-actions button { flex: 1 1 42%; }

.super-dashboard :is(h2, h3, strong, span, small, p) { font-weight: 800; }
.user-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.user-list-heading h3 { margin: 2px 0 0; font-size: 20px; }
.user-list-heading .eyebrow { margin: 0; }
.super-user-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.super-user-filters button { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: #000; background: rgba(255,255,255,.72); font-weight: 900; }
.super-user-filters button.active { color: #fff; border-color: var(--accent-strong); background: var(--accent-strong); }
.super-role-badge { width: fit-content; padding: 4px 8px; border-radius: 999px; color: #000; background: rgba(255,255,255,.7); font-size: 11px; text-transform: uppercase; }
.super-user-card-head { align-content: start; }
.super-user-card-head { gap: 7px !important; }
.super-user-card-head strong { font-size: 24px; line-height: 1.05; }
.super-user-card-head span { font-size: 15px; line-height: 1.25; }
.super-users .user-row-actions small { font-size: 15px; }
.super-users .user-row-actions button { min-height: 40px; font-size: 15px; }

@media (max-width: 720px) { .user-list-heading { align-items: stretch; flex-direction: column; } .super-user-filters button { flex: 1; } }

.super-hero h2,
.super-hero p {
  margin: 0;
}

.super-hero h2 {
  font-size: 24px;
}

.super-hero p {
  color: var(--muted);
}

.super-users {
  padding: 18px;
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.account-strip span {
  color: var(--muted);
}

.inventory-panel,
.invoice-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.inventory-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
}

.invoice-panel {
  position: sticky;
  top: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
  border-radius: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 260px;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.15);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 90px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 72px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.password-toggle:hover,
.password-toggle.is-visible {
  color: var(--accent-strong);
  background: #e8f4ef;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.filter-pill {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  border-radius: 999px;
  font-weight: 800;
}

.filter-pill.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.inventory-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}

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

.product-card {
  min-height: 256px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--theme-surface-soft);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(23, 33, 28, 0.14);
}

.product-card.is-out {
  opacity: 0.55;
}

.product-image {
  position: relative;
  min-height: 118px;
  background: var(--product-color);
  background-size: cover;
  background-position: center;
}

.product-image::after {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 34px;
  font-weight: 800;
}

.product-image.has-photo::after {
  display: none;
}

.product-body {
  flex: 1;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 12px;
  text-align: left;
}

.product-name {
  min-height: 42px;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.product-category,
.product-barcode,
.stock-warning,
.empty-state {
  color: var(--muted);
  font-size: 12px;
}

.product-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.product-actions button {
  min-height: 36px;
  padding: 0 10px;
}

.product-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.price {
  color: var(--accent-strong);
  font-size: 19px;
  font-weight: 800;
}

.stock-warning.low {
  color: var(--warning);
}

.stock-warning.service {
  color: var(--accent-strong);
  font-weight: 800;
}

.stock-warning.out {
  color: var(--danger);
}

.invoice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-field {
  margin: 10px 0 12px;
}

.customer-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.customer-suggestions {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow: auto;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161b1a;
  box-shadow: var(--shadow);
  z-index: 4;
}

.customer-suggestions button {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: transparent;
  text-align: left;
}

.customer-suggestions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.customer-suggestions span {
  color: #d7ded9;
  font-size: 12px;
}

.add-customer-button {
  min-width: 44px;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.add-customer-button.is-editing {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
}

.mixed-payment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #c7e3d8;
  border-radius: 8px;
  background: #f2faf6;
}

.mixed-payment label {
  min-width: 0;
}

.mixed-payment input,
.mixed-payment select {
  min-height: 38px;
}

.mixed-payment input.is-calculated {
  background: #edf6f1;
  color: var(--accent-strong);
  font-weight: 800;
}

#mixedCreditDaysField {
  grid-column: 1 / -1;
}

.cart-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.cart-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
}

.cart-detail {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.qty-control button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-weight: 800;
}

.qty-control input {
  min-height: 32px;
  padding: 0;
  text-align: center;
}

.cart-line-total {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.totals {
  display: grid;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.totals > div,
.tax-row {
  display: grid;
  grid-template-columns: 1fr 94px 110px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  text-transform: none;
}

.totals > div {
  grid-template-columns: 1fr 110px;
}

.tax-row input {
  min-height: 34px;
  padding: 0 8px;
}

.totals strong {
  justify-self: end;
  color: var(--text);
}

.grand-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.grand-total strong {
  color: #000;
  font-size: 22px;
}

.invoice-panel .checkout-actions button {
  min-height: 38px;
}

.print-button {
  flex: 1;
}

.product-dialog {
  width: min(860px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
  max-height: min(88vh, 920px);
  overflow: hidden;
}

.product-dialog::backdrop {
  background: rgba(8, 15, 12, 0.45);
}

.system-message-dialog {
  width: min(460px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.system-message-dialog::backdrop {
  background: rgba(8, 15, 12, 0.48);
}

.system-message-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 22px;
  background: #fff;
}

.system-message-body .dialog-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.system-message-body h2,
.system-message-body p {
  margin: 0;
}

.system-message-body h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.system-message-body #systemMessageText {
  color: var(--muted);
  line-height: 1.45;
}

.system-message-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

.onboarding-dialog::backdrop {
  background: rgba(8, 15, 12, 0.72);
}

.product-dialog form {
  padding: var(--dialog-padding);
  max-height: min(84vh, 860px);
  overflow: auto;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: var(--dialog-gap);
}

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

#productTotalCost[readonly] {
  background: #f2faf6;
  color: var(--accent-strong);
  font-weight: 800;
}

.category-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.add-category-button {
  width: 44px;
  font-size: 22px;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.new-category-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c7e3d8;
  border-radius: 8px;
  background: #f2faf6;
}

.file-field {
  grid-column: 1 / -1;
}

.file-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.dialog-actions {
  margin-top: 14px;
}

.dialog-actions .danger-button {
  margin-right: auto;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.receipt {
  display: none;
}

.print-dialog {
  width: min(1120px, calc(100vw - 24px));
  height: min(94vh, 980px);
  max-height: min(94vh, 980px);
}

.sales-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: min(88vh, 920px);
}

.print-dialog-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  height: 100%;
  padding: 18px;
  overflow: hidden;
}

.receipt-preview {
  display: block;
  width: min(820px, 100%);
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  margin: 0 auto;
  padding: 28px 32px;
  color: #000;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  font-family: Arial, sans-serif;
}

.invoice-document {
  width: min(760px, 100%);
  margin: 0 auto;
  color: #17231e;
  background: #fff;
  font-family: Arial, sans-serif;
}

.invoice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 20px;
  border-bottom: 4px solid #1f8a70;
}

.invoice-business {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}

.invoice-business .receipt-logo {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
}

.invoice-kicker,
.invoice-identity span,
.invoice-info-grid span {
  margin: 0 0 5px;
  color: #527267;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.invoice-header h1 {
  margin: 0;
  color: #10251c;
  font-size: clamp(20px, 3vw, 27px);
  line-height: 1.1;
  text-align: left;
}

.invoice-contact {
  margin: 7px 0 0;
  color: #496056;
  font-size: 11px;
  line-height: 1.45;
}

.invoice-identity {
  min-width: 142px;
  padding: 12px 14px;
  border: 1px solid #cce3d9;
  border-radius: 8px;
  background: #f1f8f5;
  text-align: right;
}

.invoice-identity span,
.invoice-identity strong,
.invoice-identity small {
  display: block;
}

.invoice-identity strong {
  color: #0b4b3b;
  font-size: 18px;
}

.invoice-identity small {
  margin-top: 5px;
  color: #4c6359;
  font-size: 10px;
  line-height: 1.35;
}

.invoice-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.invoice-info-grid > div {
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #d9e6df;
  border-radius: 7px;
  background: #fbfdfc;
}

.invoice-info-grid span,
.invoice-info-grid strong {
  display: block;
}

.invoice-info-grid strong {
  overflow-wrap: anywhere;
  color: #18261f;
  font-size: 13px;
  line-height: 1.4;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.invoice-items-table th {
  padding: 11px 10px;
  color: #fff;
  background: #16775f;
  font-size: 10px;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}

.invoice-items-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #dfe9e4;
  vertical-align: top;
}

.invoice-items-table tbody tr:nth-child(even) {
  background: #f7faf8;
}

.invoice-items-table td:first-child {
  width: 52%;
}

.invoice-items-table td small {
  display: block;
  margin-top: 3px;
  color: #62766c;
  font-size: 10px;
}

.numeric {
  text-align: right !important;
  white-space: nowrap;
}

.invoice-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(235px, 40%);
  align-items: end;
  gap: 24px;
  margin-top: 22px;
}

.invoice-thanks {
  margin: 0 0 18px;
  color: #385348;
  font-size: 13px;
  line-height: 1.55;
}

.invoice-thanks small {
  color: #71847a;
  font-size: 10px;
}

.invoice-totals {
  border: 1px solid #d4e5dc;
  border-radius: 8px;
  overflow: hidden;
}

.invoice-total-row,
.invoice-grand-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 13px;
  font-size: 12px;
}

.invoice-total-row + .invoice-total-row {
  border-top: 1px solid #e3ece7;
}

.invoice-pending {
  color: #9b4a14;
}

.invoice-grand-total {
  padding: 13px;
  color: #fff;
  background: #16775f;
  font-size: 16px;
  font-weight: 800;
}

.invoice-footer {
  margin-top: 28px;
  padding-top: 11px;
  border-top: 1px solid #dfe9e4;
  color: #72867b;
  font-size: 10px;
  text-align: center;
}

.pos-document {
  display: none;
}

.print-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0;
  padding-top: 4px;
}

.report-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.report-filter label {
  min-width: 0;
}

.report-filter button {
  min-height: 42px;
}

.appointments-dialog {
  width: min(1040px, calc(100vw - 28px));
}

.appointments-dialog {
  --appointments-bg-1: #f3f7fd;
  --appointments-bg-2: #dcecff;
  --appointments-ink: #11213b;
  --appointments-muted: #5d6b81;
  --appointments-line: #d9e2f0;
  --appointments-primary: #0b67d2;
  --appointments-primary-2: #2789f7;
  --appointments-success: #168f5c;
  --appointments-warning: #c67700;
  --appointments-danger: #b4232a;
}

.operation-dialog {
  width: calc(100vw - 24px);
  height: calc((100vh - 24px) / var(--app-scale));
  max-width: none;
  max-height: none;
}

.operation-dialog form,
.operation-dialog .print-dialog-body {
  height: 100%;
}

.operation-dialog form,
.operation-dialog .print-dialog-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.operation-dialog .form-grid,
.operation-dialog .purchase-form,
.operation-dialog .appointments-layout,
.operation-dialog .appointments-hero,
.operation-dialog #payablesListSection,
.operation-dialog .sales-list,
.operation-dialog .appointments-list,
.operation-dialog .sales-summary,
.operation-dialog .report-filter {
  min-height: 0;
}

.operation-dialog .form-grid,
.operation-dialog .purchase-form,
.operation-dialog .print-dialog-body {
  align-content: start;
}

.operation-dialog .form-grid,
.operation-dialog .purchase-form,
.operation-dialog #payablesListSection,
.operation-dialog .appointments-dialog-body {
  overflow: auto;
}

.operation-dialog .dialog-head {
  margin-bottom: 12px;
}

.operation-dialog .dialog-head h2 {
  font-size: 26px;
}

.operation-dialog .eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
}

.operation-dialog label span,
.operation-dialog .appointments-search-panel p,
.operation-dialog .appointments-agenda-head p,
.operation-dialog .appointment-editor-helper,
.operation-dialog .appointment-meta,
.operation-dialog .appointment-notes,
.operation-dialog .appointment-whatsapp-note,
.operation-dialog .appointment-audit,
.operation-dialog .sales-summary span,
.operation-dialog .sale-row span {
  font-size: 12px;
}

.operation-dialog input,
.operation-dialog select,
.operation-dialog textarea,
.operation-dialog button {
  font-size: 14px;
}

.operation-dialog .primary-button,
.operation-dialog .secondary-button,
.operation-dialog .ghost-button,
.operation-dialog .danger-button,
.operation-dialog .icon-button {
  min-height: 36px;
}

.operation-dialog .print-dialog-body {
  padding: 16px 18px;
}

.operation-dialog .dialog-actions {
  margin-top: 12px;
}

.operation-dialog .sales-summary,
.operation-dialog .appointments-summary {
  gap: 8px;
  margin-bottom: 12px;
}

.operation-dialog .sales-summary article,
.operation-dialog .appointments-summary article {
  padding: 10px 12px;
}

.operation-dialog .sales-summary strong,
.operation-dialog .appointments-summary strong {
  font-size: 18px;
}

.operation-dialog .sales-list,
.operation-dialog .appointments-list {
  max-height: none;
  height: 100%;
}

.operation-dialog .sale-row,
.operation-dialog .appointment-item,
.operation-dialog .appointments-search-result {
  padding: 10px 12px;
}

.operation-dialog .purchase-form {
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
}

.operation-dialog .purchase-line-form {
  gap: 8px;
}

.operation-dialog .appointments-dialog-body {
  gap: 12px;
}

.operation-dialog .appointments-hero,
.operation-dialog .appointments-layout {
  gap: 12px;
}

.operation-dialog .appointment-editor-trigger {
  padding: 12px 14px;
  font-size: 18px;
}

.operation-dialog .appointment-editor-body {
  padding: 0 14px 14px;
}

.appointments-dialog-body {
  display: grid;
  gap: 14px;
  color: var(--appointments-ink);
  background: radial-gradient(circle at 10% 0%, #ffffff 0%, var(--appointments-bg-1) 45%, var(--appointments-bg-2) 100%);
}

.appointments-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, auto);
  gap: 12px;
  align-items: center;
}

.appointments-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

.appointments-summary article,
.appointments-search-panel,
.appointments-agenda,
.appointment-card {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(17, 33, 59, 0.08);
}

.appointments-summary article {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 58px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
}

.appointments-summary span {
  color: var(--appointments-muted);
  font-size: 10px;
}

.appointments-summary strong {
  color: var(--appointments-ink);
  font-size: 16px;
  line-height: 1;
}

.appointments-search-panel {
  padding: 8px 10px;
  border: 1px solid var(--appointments-line);
  background: linear-gradient(135deg, #ffffff, #f7faff);
}

.appointments-search-panel p,
.appointments-agenda-head p,
.appointment-editor-helper,
.appointment-meta,
.appointment-notes,
.appointment-whatsapp-note,
.appointment-audit,
.appointments-search-empty,
.appointments-search-result span {
  color: var(--appointments-muted);
}

.appointments-search-form {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 0;
}

.appointments-search-inline-label {
  color: var(--appointments-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.appointments-search-results {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.appointments-search-empty {
  padding: 10px 12px;
  border: 1px dashed var(--appointments-line);
  border-radius: 12px;
  background: #fff;
  font-size: 11px;
}

.appointments-search-result {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--appointments-line);
  border-radius: 12px;
  background: #fff;
}

.appointments-search-result strong,
.appointment-title {
  display: block;
  color: #0f3f86;
}

.appointments-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 14px;
  align-items: start;
}

.appointments-layout.is-collapsed {
  grid-template-columns: 154px minmax(0, 1fr);
}

.appointment-editor {
  overflow: hidden;
  border-radius: 12px;
}

.appointment-editor[open] {
  background: transparent;
}

.appointment-editor-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--appointments-primary), var(--appointments-primary-2));
  box-shadow: 0 8px 18px rgba(11, 103, 210, 0.2);
}

.appointment-editor-trigger::-webkit-details-marker {
  display: none;
}

.appointment-editor-trigger svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  transition: transform 0.18s ease;
}

.appointment-editor[open] .appointment-editor-trigger svg {
  transform: rotate(45deg);
}

.appointment-editor[open] .appointment-editor-trigger {
  background: #e8f2ff;
  color: #0f4da6;
  box-shadow: none;
}

.appointment-editor-body {
  padding: 0 16px 16px;
}

.appointment-editor-helper {
  margin: 0 0 10px;
  line-height: 1.45;
  font-size: 13px;
}

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

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

.appointment-date-field,
.appointment-time-field {
  min-width: 0;
}

.appointment-form-actions {
  margin-top: 4px;
}

.appointment-form button {
  min-height: 42px;
}

.appointment-time-picker {
  display: grid;
  grid-template-columns: minmax(58px, 0.9fr) minmax(64px, 1fr) minmax(72px, 1fr);
  gap: 8px;
}

.appointment-time-picker select {
  min-width: 0;
  width: 100%;
  padding-right: 26px;
}

.appointment-time-picker select#appointmentHour {
  min-width: 58px;
}

.appointment-time-picker select#appointmentMinute {
  min-width: 64px;
}

.appointment-time-picker select#appointmentPeriod {
  min-width: 72px;
}

.appointments-agenda {
  padding: 12px;
}

.appointments-agenda-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.appointments-agenda-filter {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.appointments-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 50vh;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}

.appointments-agenda-head h3 {
  font-size: 22px;
  color: var(--appointments-ink);
}

.appointments-agenda-head p {
  font-size: 12px;
}

.operation-dialog .appointments-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-self: center;
}

.operation-dialog .appointments-summary article {
  min-height: 52px;
  padding: 7px 9px;
  border-radius: 10px;
}

.operation-dialog .appointments-summary strong {
  font-size: 14px;
}

.operation-dialog .appointments-summary span {
  font-size: 9px;
}

.operation-dialog .appointments-search-panel,
.operation-dialog .appointments-agenda,
.operation-dialog .appointment-card {
  padding: 10px;
}

.operation-dialog .appointment-card {
  padding: 0;
}

.operation-dialog .appointments-search-panel {
  max-width: none;
}

.operation-dialog .appointments-search-form {
  grid-template-columns: auto minmax(240px, 320px) 96px;
  gap: 8px;
}

.operation-dialog .appointments-search-results {
  max-height: 86px;
  overflow: auto;
}

.operation-dialog .appointments-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: stretch;
  align-items: center;
}

.operation-dialog .appointments-layout {
  grid-template-columns: 410px minmax(0, 1fr);
  min-height: 0;
}

.operation-dialog .appointments-layout.is-collapsed {
  grid-template-columns: 150px minmax(0, 1fr);
}

.operation-dialog .appointments-agenda {
  min-height: 0;
}

.operation-dialog .appointments-dialog-body {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
}

.operation-dialog .appointments-search-panel {
  padding: 7px 9px;
}

.operation-dialog .appointments-search-form {
  margin-top: 0;
  align-items: center;
}

.operation-dialog .appointments-search-inline-label {
  font-size: 9px;
}

.operation-dialog .appointments-search-form input,
.operation-dialog .appointments-search-form button {
  min-height: 31px;
  font-size: 13px;
}

.operation-dialog .appointments-search-form button {
  padding-inline: 10px;
}

.operation-dialog .appointments-agenda {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.operation-dialog .appointments-list {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.operation-dialog .appointment-card {
  height: 100%;
}

.operation-dialog .appointment-editor {
  height: 100%;
}

.operation-dialog .appointment-editor[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.operation-dialog .appointment-editor-body {
  overflow: auto;
}

.operation-dialog .appointment-form {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.operation-dialog .appointment-date-field,
.operation-dialog .appointment-time-field {
  min-width: 0;
}

.operation-dialog .appointment-date-field {
  grid-column: span 1;
}

.operation-dialog .appointment-time-field {
  grid-column: 1 / -1;
}

.operation-dialog .appointment-time-picker {
  grid-template-columns: minmax(84px, 1fr) minmax(92px, 1fr) minmax(98px, 1fr);
  gap: 8px;
}

.operation-dialog .appointment-time-picker select {
  min-height: 31px;
  padding-left: 8px;
  padding-right: 26px;
  font-size: 12px;
}

@media (min-height: 820px) {
  .operation-dialog {
    height: calc((100vh - 8px) / var(--app-scale));
  }

  .operation-dialog .print-dialog-body {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .operation-dialog .appointments-list {
    min-height: 320px;
  }
}

.appointment-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--appointments-line);
  border-left: 4px solid #c6d2cc;
  border-radius: 14px;
  background: #fff;
}

.appointment-item.status-pending {
  border-left-color: #94a3b8;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.appointment-item.status-active {
  border-left-color: #2789f7;
  border-color: #bad9ff;
  background: linear-gradient(135deg, #f7fbff 0%, #eaf4ff 100%);
}

.appointment-item.status-warning {
  border-left-color: #e49a13;
  border-color: #f4d7a0;
  background: linear-gradient(135deg, #fffdf7 0%, #fff4df 100%);
}

.appointment-item.status-suspended {
  border-left-color: #d73d4a;
  border-color: #f2bdc2;
  background: linear-gradient(135deg, #fffafa 0%, #fdebed 100%);
}

.appointment-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.appointment-main {
  display: grid;
  gap: 6px;
}

.appointment-meta {
  font-size: 13px;
  color: var(--appointments-muted);
}

.appointment-notes {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  color: #334155;
}

.appointment-badges,
.appointment-whatsapp {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.appointment-whatsapp-note,
.appointment-audit {
  font-size: 12px;
}

.appointment-whatsapp-badge.unsent {
  background: #fde8ed;
  color: #b4233b;
}

.appointment-whatsapp-badge.sent {
  background: #d8f8e5;
  color: #08763a;
}

.appointment-whatsapp-badge.error {
  background: #fde8ea;
  color: #b4232a;
}

.appointment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.appointment-actions button,
.appointment-actions a {
  min-height: 34px;
  border-radius: 12px;
  font-weight: 700;
}

.appointments-dialog .secondary-button,
.appointments-dialog .ghost-button {
  border: 1px solid var(--appointments-line);
}

.appointments-dialog .primary-button {
  background: linear-gradient(135deg, var(--appointments-primary), var(--appointments-primary-2));
}

.appointments-dialog .primary-button:hover {
  background: linear-gradient(135deg, #0a5cb9, #1f7ae0);
}

.appointments-dialog .secondary-button {
  color: var(--appointments-ink);
  background: #eef4fb;
}

.appointments-dialog .ghost-button {
  color: var(--appointments-ink);
  background: #eef4fb;
}

.appointments-dialog a.secondary-button[data-whatsapp-appointment] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #128c4f, #25b967);
}

.appointments-dialog .status-pending {
  color: #566476;
}

.appointments-dialog .status-active {
  color: #0f4da6;
}

.appointments-dialog .status-warning {
  color: #9a5d00;
}

.appointments-dialog .status-suspended {
  color: #b4232a;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-menu {
  position: relative;
  margin: 0;
}

.status-menu > summary {
  list-style: none;
}

.status-menu > summary::-webkit-details-marker {
  display: none;
}

.status-trigger {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #b8c7da;
  border-radius: 11px;
  background: #fff;
  color: #174f91;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(15, 63, 134, 0.08);
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.status-trigger:hover {
  background: #eef5ff;
  border-color: #6fa9e9;
  transform: translateY(-1px);
}

.status-menu[open] .status-trigger {
  background: #e5f0ff;
  border-color: #2789f7;
}

.status-trigger svg {
  width: 19px;
  height: 19px;
}

.status-menu-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 7px);
  z-index: 60;
  width: 205px;
  padding: 7px;
  border: 1px solid #cbd8e8;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 45, 80, 0.18);
}

.status-menu-title {
  padding: 5px 8px 7px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #24364d;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.status-option:hover {
  background: #f0f5fb;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #94a3b8;
}

.status-option-confirmada .status-dot {
  background: #2789f7;
}

.status-option-atendida .status-dot {
  background: #1d9c62;
}

.status-option-no_asistio .status-dot {
  background: #e49a13;
}

.status-option-cancelada .status-dot {
  background: #d73d4a;
}

.operation-dialog .appointment-item {
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
}

.operation-dialog .appointment-top {
  gap: 8px;
  align-items: flex-start;
}

.operation-dialog .appointment-main {
  gap: 4px;
}

.operation-dialog .appointment-title {
  font-size: 13px;
  line-height: 1.25;
}

.operation-dialog .appointment-meta,
.operation-dialog .appointment-notes,
.operation-dialog .appointment-whatsapp-note,
.operation-dialog .appointment-audit {
  font-size: 10.5px;
  line-height: 1.35;
}

.operation-dialog .appointment-notes {
  padding: 8px 10px;
}

.operation-dialog .appointment-actions {
  gap: 6px;
}

.operation-dialog .appointment-actions button,
.operation-dialog .appointment-actions a {
  min-height: 28px;
  padding-inline: 8px;
  font-size: 11px;
}

.operation-dialog .status-trigger {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.operation-dialog .status-trigger svg {
  width: 17px;
  height: 17px;
}

.operation-dialog .status-menu-panel {
  width: 190px;
}

.operation-dialog .status-option {
  padding: 7px 9px;
  font-size: 11.5px;
}

@media (max-width: 1180px) {
  .appointments-list,
  .operation-dialog .appointments-list {
    grid-template-columns: 1fr;
  }
}

.purchase-form {
  display: grid;
  grid-template-columns: minmax(200px, 1.35fr) minmax(170px, 1fr) minmax(170px, 0.95fr) minmax(170px, 0.95fr);
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

#purchaseCreditDaysField {
  min-width: 0;
}

.purchase-line-form,
.purchase-lines,
.purchase-form .dialog-actions {
  grid-column: 1 / -1;
}

.purchase-line-form {
  display: grid;
  grid-template-columns: minmax(240px, 2.3fr) minmax(130px, 1fr) minmax(110px, 0.9fr) 82px minmax(115px, 0.95fr) minmax(115px, 0.95fr) auto;
  align-items: end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.purchase-product-field {
  min-width: 0;
}

.purchase-qty-field {
  max-width: 84px;
}

#purchaseProductQty {
  padding-left: 10px;
  padding-right: 8px;
}

.purchase-lines {
  display: grid;
  gap: 6px;
}

.purchase-line-header,
.purchase-line-row,
.purchase-line-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 110px 110px auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.purchase-line-header {
  color: var(--muted);
  font-size: 12px;
  background: #f2faf6;
}

.purchase-line-total {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: end;
  color: var(--accent-strong);
  font-weight: 900;
}

.sales-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sales-summary article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.sales-summary span,
.sale-row span {
  color: var(--muted);
  font-size: 12px;
}

.sales-summary strong {
  color: var(--accent-strong);
  font-size: 18px;
}

.payment-breakdown {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-breakdown div {
  display: grid;
  gap: 4px;
}

.sales-list {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 4px;
}

.sale-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sale-row > div:first-child {
  display: grid;
  gap: 4px;
}

.sale-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sale-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.sale-actions button {
  min-height: 34px;
}

.receipt-brand {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin-bottom: 8px;
  text-align: center;
}

.receipt-brand p {
  margin: 0;
  font-size: 11px;
}

.receipt-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.receipt h1 {
  margin: 0 0 4px;
  font-size: 22px;
  text-align: center;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed #aaa;
  font-size: 12px;
}

.receipt-total {
  font-size: 16px;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .auth-screen {
    padding: 24px;
  }

  .auth-layout {
    width: min(760px, 100%);
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    gap: 24px;
    padding: 38px 42px 32px;
  }

  .auth-brand .brand-mark {
    width: 124px;
    height: 124px;
    border-width: 4px;
    border-radius: 22px;
  }

  .auth-brand h1 {
    font-size: 48px;
  }

  .auth-brand p {
    max-width: 620px;
  }

  .auth-showcase-note {
    display: none;
  }

  .auth-access {
    padding: 42px;
  }

  .appointments-hero,
  .appointments-layout {
    grid-template-columns: 1fr;
  }

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

  .appointments-agenda-head,
  .appointment-top,
  .appointments-search-result {
    display: grid;
  }

  .appointments-agenda-filter,
  .appointments-search-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-self: stretch;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button,
  .top-actions summary {
    flex: 1;
  }

  .top-actions-menu {
    flex: 1;
  }

  .top-actions-menu-panel {
    left: 0;
    right: auto;
    min-width: min(280px, 100%);
  }

  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .invoice-panel {
    position: static;
    height: auto;
    min-height: 560px;
    overflow: visible;
  }

  .inventory-panel {
    overflow: visible;
  }
}

@media (max-width: 720px) {
  .auth-screen {
    align-items: flex-start;
    padding: 12px;
  }

  .auth-layout {
    border-radius: 20px;
  }

  .auth-showcase {
    gap: 14px;
    padding: 26px 22px 24px;
  }

  .auth-brand .brand-mark {
    width: 92px;
    height: 92px;
    margin-bottom: 2px;
    border-width: 3px;
    border-radius: 18px;
  }

  .auth-brand h1 {
    font-size: 38px;
    letter-spacing: -1px;
  }

  .auth-brand p {
    font-size: 14px;
    line-height: 1.5;
  }

  .auth-highlights,
  .auth-showcase-note {
    display: none;
  }

  .auth-access {
    padding: 30px 22px 34px;
  }

  .auth-card {
    gap: 18px;
  }

  .auth-card-head h2 {
    font-size: 26px;
  }

  .auth-card input,
  .auth-submit {
    min-height: 50px;
  }

  .topbar,
  .pos-layout {
    padding: 12px;
  }

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

  .inventory-meta {
    display: grid;
  }

  .checkout-actions {
    display: grid;
  }

  .sales-summary,
  .payment-breakdown,
  .report-filter,
  .appointments-summary,
  .appointment-form,
  .purchase-form,
  .purchase-line-form,
  .purchase-line-header,
  .purchase-line-row,
  .mixed-payment,
  .sale-row {
    grid-template-columns: 1fr;
  }

  .super-hero {
    display: grid;
  }

  .account-strip {
    display: grid;
    padding: 10px 12px;
  }

  .appointment-time-picker,
  .appointments-agenda-filter,
  .appointments-search-form {
    grid-template-columns: 1fr;
  }

  /* Safari móvil reduce el área útil con sus barras. La vista previa debe
     mantenerse dentro del viewport dinámico y conservar las acciones visibles. */
  .print-dialog {
    width: calc(100vw - 12px);
    width: calc(100dvw - 12px);
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
  }

  .print-dialog .print-dialog-body {
    gap: 10px;
    padding: 12px;
  }

  .print-dialog .dialog-head {
    margin-bottom: 0;
  }

  .print-dialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: 0 -8px 16px rgba(20, 30, 25, 0.06);
  }

  .print-dialog .dialog-actions button {
    width: 100%;
    min-height: 44px;
  }

  .print-dialog .receipt-preview {
    padding: 18px;
    border-radius: 7px;
  }
}

@media (max-width: 620px) {
  .invoice-header,
  .invoice-bottom {
    grid-template-columns: 1fr;
  }

  .invoice-header {
    display: grid;
  }

  .invoice-identity {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .invoice-info-grid {
    grid-template-columns: 1fr;
  }

  .invoice-bottom {
    display: grid;
    gap: 4px;
  }

  .invoice-thanks {
    margin: 6px 0 16px;
  }

  .invoice-items-table {
    font-size: 11px;
  }

  .invoice-items-table th,
  .invoice-items-table td {
    padding: 9px 6px;
  }

  .invoice-items-table th:nth-child(3),
  .invoice-items-table td:nth-child(3) {
    display: none;
  }

  .invoice-items-table td:first-child {
    width: auto;
  }
}

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

  #printReceipt,
  #printReceipt * {
    visibility: visible;
  }

  #printReceipt {
    display: block;
    position: absolute;
    inset: 0;
    width: 196mm;
    min-height: auto;
    padding: 0;
    color: #000;
    background: #fff;
    font-family: Arial, sans-serif;
  }

  body.print-pos #printReceipt {
    width: 80mm;
    min-height: auto;
    padding: 6mm;
  }

  body.print-invoice #printReceipt {
    width: 196mm;
  }

  body.print-invoice #printReceipt .invoice-document {
    display: block;
    width: 100%;
  }

  body.print-invoice #printReceipt .pos-document,
  body.print-pos #printReceipt .invoice-document {
    display: none;
  }

  body.print-pos #printReceipt .pos-document {
    display: block;
  }

  body.print-invoice #printReceipt .invoice-header {
    padding-bottom: 5mm;
  }

  body.print-invoice #printReceipt .invoice-info-grid {
    margin: 5mm 0;
  }

  body.print-invoice #printReceipt .invoice-items-table {
    font-size: 10.5pt;
  }

  body.print-invoice #printReceipt .invoice-items-table th {
    padding: 3mm;
  }

  body.print-invoice #printReceipt .invoice-items-table td {
    padding: 3.2mm 3mm;
  }

  body.print-invoice #printReceipt .invoice-bottom {
    margin-top: 6mm;
  }

  body.print-invoice #printReceipt .invoice-footer {
    margin-top: 7mm;
  }

  #printReceipt h1 {
    margin: 0 0 4px;
    font-size: 22px;
    text-align: center;
  }

  #printReceipt .receipt-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px dashed #aaa;
    font-size: 12px;
  }

  body.print-pos #printReceipt .receipt-row {
    gap: 6px;
    font-size: 11px;
  }

  body.print-pos #printReceipt .receipt-date {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
  }

  body.print-pos #printReceipt .receipt-date strong {
    justify-self: start;
  }

  #printReceipt .receipt-total {
    font-size: 16px;
    font-weight: 800;
  }
}
.inventory-panel,
.invoice-panel {
  min-width: 0;
}

@media (max-width: 1440px), (max-height: 900px) {
  :root {
    --control-height: 38px;
    --dialog-padding: 16px;
    --dialog-gap: 14px;
  }

  .topbar {
    min-height: 72px;
    padding: 10px 14px;
    gap: 12px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 12px;
  }

  .business-logo {
    width: 48px;
    height: 48px;
  }

  .business-identity p {
    font-size: 13px;
  }

  .product-dialog {
    width: min(780px, calc(100vw - 24px));
    max-height: 86vh;
  }

  .sales-dialog {
    width: min(920px, calc(100vw - 24px));
    max-height: 86vh;
  }

  .appointments-dialog {
    width: min(940px, calc(100vw - 24px));
  }

  .print-dialog {
    width: min(980px, calc(100vw - 20px));
    height: min(94vh, 940px);
    max-height: min(94vh, 940px);
  }

  .print-dialog-body {
    padding: 16px;
  }

  .dialog-head h2 {
    font-size: 24px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .sales-list,
  .appointments-list {
    max-height: 42vh;
  }

  .top-actions-menu-panel {
    min-width: 190px;
  }

  .operation-dialog {
    width: calc(100vw - 18px);
    height: calc((100vh - 18px) / var(--app-scale));
  }
}

@media (max-width: 1280px), (max-height: 820px) {
  .product-dialog {
    width: min(720px, calc(100vw - 20px));
  }

  .sales-dialog {
    width: min(860px, calc(100vw - 20px));
  }

  .appointments-dialog {
    width: min(880px, calc(100vw - 20px));
  }

  .print-dialog {
    width: min(920px, calc(100vw - 16px));
    height: min(95vh, 900px);
    max-height: min(95vh, 900px);
  }

  .receipt-preview {
    width: min(740px, 100%);
    padding: 22px 24px;
  }

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

  .appointments-hero,
  .appointments-layout {
    gap: 12px;
  }

  .operation-dialog {
    width: calc(100vw - 14px);
    height: calc((100vh - 14px) / var(--app-scale));
  }

  .operation-dialog .print-dialog-body,
  .operation-dialog form {
    padding: 14px;
  }

  .operation-dialog .dialog-head h2 {
    font-size: 23px;
  }
}

/* El directorio es un diálogo con lista larga. En Safari móvil necesita un
   alto explícito del viewport dinámico; de otro modo su área central queda
   transparente o fuera de la pantalla detrás del POS. */
.clients-dialog .print-dialog-body {
  background: #fff;
}

@media (max-width: 720px) {
  .clients-dialog {
    width: calc(100vw - 12px);
    width: calc(100dvw - 12px);
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
  }

  .clients-dialog .print-dialog-body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    height: 100%;
    padding: 14px 12px calc(12px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .clients-dialog .print-dialog-body > :nth-child(2) {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .clients-dialog .sales-list {
    max-height: none;
    overflow: visible;
  }

  .clients-dialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
  }

  .clients-dialog .dialog-actions button {
    width: 100%;
    min-height: 44px;
  }
}
