html {
  background-color: var(--bg, #f5f5f5) !important;
}

@font-face {
  font-family: "PingAR LT";
  src: url("../fonts/PingAR-LT-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PingAR LT";
  src: url("../fonts/PingAR-LT-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --admin-shell-padding: 16px;
  --admin-shell-height: calc(100dvh - (var(--admin-shell-padding) * 2));
  --admin-sidebar-width: 228px;
  --admin-sidebar-gap: 16px;
  --admin-sidebar-link-font-size: 14px;
  --admin-sidebar-title-font-size: 12px;
  --brand-font: "PingAR LT", "Trebuchet MS", "Lucida Sans", sans-serif;
  --identity-accent: #d10000;
  --identity-accent-rgb: 209, 0, 0;
  --identity-accent-strong: #a80000;
  --identity-accent-soft: #ffe5e5;
  --identity-danger: #8f0000;
  --identity-danger-rgb: 143, 0, 0;
}

body.admin-ui.has-fixed-sidebar {
  position: relative;
  min-height: 100dvh;
  height: 100dvh;
  display: grid !important;
  grid-template-columns: var(--admin-sidebar-width) minmax(0, 1fr);
  gap: var(--admin-sidebar-gap);
  align-items: start;
  padding: var(--admin-shell-padding) !important;
  overflow: hidden;
}

body.admin-ui.has-fixed-sidebar > .page,
body.admin-ui.has-fixed-sidebar > .pos-shell,
body.admin-ui.has-fixed-sidebar > main.page {
  grid-column: 2;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  height: var(--admin-shell-height);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.admin-ui.cashier-theme.legacy-design {
  direction: rtl;
  min-height: 100dvh;
  padding: 16px !important;
  background:
    radial-gradient(900px 300px at 10% 0%, rgba(var(--identity-accent-rgb), 0.08), transparent),
    radial-gradient(700px 300px at 90% 10%, rgba(0, 0, 0, 0.04), transparent),
    radial-gradient(700px 260px at 50% 100%, rgba(var(--identity-accent-rgb), 0.05), transparent),
    #ffffff !important;
  color: #111111 !important;
  font-family: var(--brand-font);
}

body.admin-ui.cashier-theme.legacy-design .page {
  width: 100% !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
}

body.admin-ui.cashier-theme.legacy-design.has-fixed-sidebar > .page {
  max-width: none !important;
  margin: 0 !important;
}

body.admin-ui.cashier-theme.legacy-design .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px !important;
  padding: 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.06);
}

body.admin-ui.cashier-theme.legacy-design .topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
}

body.admin-ui.cashier-theme.legacy-design .topbar > .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-inline-start: auto;
}

body.admin-ui.cashier-theme.legacy-design .topbar > .actions .btn,
body.admin-ui.cashier-theme.legacy-design .topbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

body.admin-ui.cashier-theme.legacy-design .card {
  background: #ffffff !important;
  border: 1px solid #e5e7eb;
  border-radius: 16px !important;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.06);
}

body.admin-ui.cashier-theme.legacy-design .field label,
body.admin-ui.cashier-theme.legacy-design .option span {
  text-align: right;
}

body.admin-ui.cashier-theme.legacy-design input:not([type="color"]):not([type="range"]),
body.admin-ui.cashier-theme.legacy-design textarea,
body.admin-ui.cashier-theme.legacy-design select {
  text-align: right;
}

body.admin-ui.cashier-theme .ltr {
  direction: ltr !important;
  text-align: left !important;
}

body.admin-ui.cashier-theme.legacy-design .btn {
  background: var(--accent, var(--identity-accent)) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

body.admin-ui.cashier-theme.legacy-design .btn.ghost {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #e5e7eb !important;
}

body.admin-ui.cashier-theme.legacy-design .btn.danger {
  background: var(--identity-danger) !important;
  color: #ffffff !important;
}

body.admin-ui.fullscreen-pos.has-fixed-sidebar > .page {
  height: calc(100dvh - 32px) !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

body.admin-ui.fullscreen-pos.has-fixed-sidebar > .page > .screen-scroll {
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding-inline-end: 2px;
}

body.admin-ui.fullscreen-pos.legacy-design .topbar {
  margin-bottom: 0 !important;
}

body.admin-ui.fullscreen-pos.legacy-design .card {
  padding: 12px !important;
  border-radius: 14px !important;
}

body.admin-ui.fullscreen-pos.legacy-design .btn {
  min-height: 34px !important;
  padding: 7px 10px !important;
  font-size: 12px !important;
}

body.admin-ui.fullscreen-pos.legacy-design input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
body.admin-ui.fullscreen-pos.legacy-design select,
body.admin-ui.fullscreen-pos.legacy-design textarea {
  min-height: 34px;
  font-size: 12px !important;
  padding: 7px 10px !important;
}

body.admin-ui.fullscreen-pos.legacy-design .topbar h1,
body.admin-ui.fullscreen-pos.legacy-design .title h1 {
  font-size: clamp(20px, 2vw, 26px) !important;
}

body.admin-ui.fullscreen-pos.legacy-design .title p {
  font-size: 12px !important;
}

.admin-sidebar-fixed {
  position: sticky;
  grid-column: 1;
  inset-inline-end: auto;
  top: var(--admin-shell-padding);
  bottom: auto;
  width: 100%;
  min-width: var(--admin-sidebar-width);
  max-width: var(--admin-sidebar-width);
  height: var(--admin-shell-height);
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.06);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  z-index: 25;
  overflow: auto;
}

.admin-sidebar-brand {
  font-size: 22px;
  font-weight: 900;
  color: #111111;
  letter-spacing: .5px;
  padding: 2px 6px 8px;
}

.admin-sidebar-main {
  display: grid;
  gap: 8px;
}

.admin-sidebar-account {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed rgba(31, 26, 23, 0.16);
  display: grid;
  gap: 8px;
}

.admin-sidebar-title {
  font-size: var(--admin-sidebar-title-font-size);
  font-weight: 900;
  color: #3a3a3a;
  padding-inline: 6px;
}


.admin-sidebar-link,
.admin-sidebar-logout {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #111111;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  font-size: var(--admin-sidebar-link-font-size);
  line-height: 1.2;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.admin-sidebar-link .fi,
.admin-sidebar-logout .fi {
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}

.admin-sidebar-link .label,
.admin-sidebar-logout .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar-link .admin-sidebar-badge {
  margin-inline-start: auto;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding-inline: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  background: var(--identity-accent-strong);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(var(--identity-accent-rgb), 0.24);
}

.admin-sidebar-link .admin-sidebar-badge[hidden] {
  display: none !important;
}

/* Unified topbar scale across all admin pages */
body.admin-ui.has-fixed-sidebar {
  --admin-topbar-pad-block: 16px;
  --admin-topbar-pad-inline: 18px;
  --admin-topbar-radius: 22px;
  --admin-topbar-min-height: 108px;
  --admin-topbar-h1-size: clamp(34px, 2.15vw, 42px);
  --admin-topbar-sub-size: 13px;
  --admin-topbar-btn-height: 42px;
  --admin-topbar-btn-radius: 12px;
}

body.admin-ui.has-fixed-sidebar .topbar {
  min-height: var(--admin-topbar-min-height);
  margin-bottom: 12px !important;
  padding: var(--admin-topbar-pad-block) var(--admin-topbar-pad-inline) !important;
  border-radius: var(--admin-topbar-radius) !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 8px !important;
}

body.admin-ui.has-fixed-sidebar .topbar h1,
body.admin-ui.has-fixed-sidebar .topbar .title h1,
body.admin-ui.has-fixed-sidebar .topbar .title-stack h1 {
  font-size: var(--admin-topbar-h1-size) !important;
  line-height: 1.08 !important;
  margin: 0 !important;
}

body.admin-ui.has-fixed-sidebar .topbar .topbar-note,
body.admin-ui.has-fixed-sidebar .topbar .title-sub,
body.admin-ui.has-fixed-sidebar .topbar .title p,
body.admin-ui.has-fixed-sidebar .topbar .title-stack p,
body.admin-ui.has-fixed-sidebar .topbar > div > p {
  font-size: var(--admin-topbar-sub-size) !important;
  line-height: 1.45 !important;
  margin-top: 4px !important;
}

/* Topbar content policy: title + description only */
body.admin-ui.has-fixed-sidebar .topbar .actions,
body.admin-ui.has-fixed-sidebar .topbar .topbar-actions,
body.admin-ui.has-fixed-sidebar .topbar .topbar-kicker,
body.admin-ui.has-fixed-sidebar .topbar .title-kicker,
body.admin-ui.has-fixed-sidebar .topbar .pill,
body.admin-ui.has-fixed-sidebar .topbar .btn,
body.admin-ui.has-fixed-sidebar .topbar button,
body.admin-ui.has-fixed-sidebar .topbar a.btn,
body.admin-ui.has-fixed-sidebar .topbar i,
body.admin-ui.has-fixed-sidebar .topbar .fi {
  display: none !important;
}

body.admin-ui.has-fixed-sidebar .topbar > div,
body.admin-ui.has-fixed-sidebar .topbar .title,
body.admin-ui.has-fixed-sidebar .topbar .title-stack {
  width: 100% !important;
  max-width: 100% !important;
}

.admin-sidebar-link:hover,
.admin-sidebar-logout:hover {
  border-color: #d9d9d9;
  background: #f5f5f5;
}

.admin-sidebar-link.active {
  border-color: rgba(var(--identity-accent-rgb), 0.35);
  background: var(--identity-accent-soft);
  color: var(--identity-accent-strong);
}

.admin-sidebar-logout {
  border-color: rgba(179, 74, 60, 0.34);
  background: rgba(179, 74, 60, 0.12);
  color: #8f0000;
}

.admin-sidebar-logout:hover {
  border-color: rgba(179, 74, 60, 0.45);
  background: rgba(179, 74, 60, 0.2);
}

body:not(.admin-ui) {
  background-color: transparent !important;
}

body:not(.admin-ui),
body:not(.admin-ui).cart-open {
  min-height: 100dvh !important;
  padding-bottom: 0 !important;
}

body:not(.admin-ui) .page-content {
  padding-bottom: 120px !important;
}

@supports (-webkit-touch-callout: none) {
  body:not(.admin-ui) {
    overscroll-behavior-y: none;
  }
}

body:not(.admin-ui) .modal,
body:not(.admin-ui) .popup,
body:not(.admin-ui) .product-popup,
body:not(.admin-ui) .bottom-sheet,
body:not(.admin-ui) [role="dialog"] {
  position: fixed !important;
  inset: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  max-height: 100dvh !important;
  height: 100dvh !important;
}

body:not(.admin-ui) .cart-panel {
  position: fixed !important;
  inset: auto !important;
  left: 50% !important;
  top: 50% !important;
  width: min(78vw, 540px) !important;
  max-width: 540px !important;
  height: auto !important;
  max-height: min(86dvh, 820px) !important;
  margin: 0 !important;
  border-radius: 18px !important;
  transform: translate(-50%, -50%) !important;
}

html.is-desktop-app body {
  -webkit-user-select: none;
  user-select: none;
}

html.is-desktop-app input,
html.is-desktop-app textarea,
html.is-desktop-app select,
html.is-desktop-app option,
html.is-desktop-app [contenteditable="true"],
html.is-desktop-app [contenteditable=""],
html.is-desktop-app .allow-select {
  -webkit-user-select: text;
  user-select: text;
}

@media (max-width: 760px) {
  body.admin-ui.has-fixed-sidebar .topbar {
    min-height: 0;
    padding: 14px !important;
    border-radius: 18px !important;
  }

  body.admin-ui.has-fixed-sidebar .topbar h1,
  body.admin-ui.has-fixed-sidebar .topbar .title h1,
  body.admin-ui.has-fixed-sidebar .topbar .title-stack h1 {
    font-size: clamp(28px, 6.8vw, 32px) !important;
  }

  body.admin-ui.legacy-design {
    min-height: 100dvh;
    padding: 18px 12px 24px !important;
  }

  body.admin-ui.legacy-design .page {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.admin-ui.legacy-design .topbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  body.admin-ui.legacy-design .topbar > div,
  body.admin-ui.legacy-design .topbar .actions {
    width: 100%;
  }

  body.admin-ui.cashier-theme.legacy-design .topbar > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-inline-start: 0;
  }

  body.admin-ui.cashier-theme.legacy-design .topbar > .actions .btn {
    width: 100%;
  }

  body.admin-ui.legacy-design .topbar .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.admin-ui.legacy-design .topbar .actions .btn,
  body.admin-ui.legacy-design .topbar > div .btn {
    width: 100%;
    justify-content: center;
  }

  body.admin-ui.legacy-design .card {
    padding: 12px !important;
    border-radius: 14px !important;
  }

  body.admin-ui.legacy-design .btn {
    min-height: 40px;
  }

  body.admin-ui.legacy-design .modal {
    padding: 12px !important;
  }

  body.admin-ui.legacy-design .modal .modal-card {
    width: min(100%, 720px) !important;
    max-width: min(100%, 720px) !important;
    max-height: 88dvh !important;
    overflow: auto !important;
  }
}

@media (max-width: 980px) {
  :root {
    --admin-shell-padding: 12px;
    --admin-sidebar-width: 100%;
    --admin-sidebar-gap: 12px;
    --admin-sidebar-link-font-size: 13px;
  }

  body.admin-ui.has-fixed-sidebar {
    grid-template-columns: 1fr;
    padding: 12px !important;
    gap: 10px;
    height: auto;
    overflow: visible;
  }

  body.admin-ui.has-fixed-sidebar > .page,
  body.admin-ui.has-fixed-sidebar > .pos-shell,
  body.admin-ui.has-fixed-sidebar > main.page {
    grid-column: 1;
    height: auto;
    overflow: visible;
  }

  body.admin-ui.fullscreen-pos.has-fixed-sidebar > .page {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  body.admin-ui.fullscreen-pos.has-fixed-sidebar > .page > .screen-scroll {
    height: auto;
    overflow: visible;
  }

  .admin-sidebar-fixed {
    inset-inline-end: auto;
    top: 10px;
    bottom: auto;
    height: auto;
    min-height: 0;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: auto hidden;
  }

  .admin-sidebar-brand {
    font-size: 16px;
    text-align: right;
    padding: 0 4px;
    flex: 0 0 auto;
  }

  .admin-sidebar-main,
  .admin-sidebar-account {
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
  }

  .admin-sidebar-link,
  .admin-sidebar-logout {
    justify-content: flex-start;
    gap: 6px;
    padding: 9px 10px;
    min-height: 36px;
    width: auto;
    white-space: nowrap;
  }

  .admin-sidebar-title {
    display: none;
  }
}

@media (max-width: 520px) {
  body.admin-ui.legacy-design .topbar .actions {
    grid-template-columns: 1fr;
  }

  body.admin-ui.cashier-theme.legacy-design .topbar > .actions {
    grid-template-columns: 1fr;
  }
}
