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

:root {
  --admin-sidebar-width: 228px;
  --admin-sidebar-gap: 16px;
}

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: 16px !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 {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}

body.admin-ui.cashier-theme {
  direction: rtl;
  min-height: 100dvh;
  padding: 16px !important;
  background:
    radial-gradient(900px 300px at 10% 0%, #f2f2f2, transparent),
    radial-gradient(700px 300px at 90% 10%, #f1f5f9, transparent),
    radial-gradient(700px 260px at 50% 100%, #eceff3, transparent),
    #f8fafc !important;
  color: #111111 !important;
  font-family: "Trebuchet MS", "Lucida Sans", sans-serif;
}

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

body.admin-ui.cashier-theme .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 .topbar h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 30px);
}

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

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

body.admin-ui.cashier-theme .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 .field label,
body.admin-ui.cashier-theme .option span {
  text-align: right;
}

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

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

body.admin-ui.cashier-theme .btn {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

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

body.admin-ui.cashier-theme .btn.danger {
  background: #b91c1c !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 .topbar {
  margin-bottom: 0 !important;
}

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

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

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

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

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

.admin-sidebar-fixed {
  position: sticky;
  inset-inline-end: auto;
  top: 16px;
  bottom: auto;
  width: 100%;
  height: calc(100dvh - 32px);
  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: #1f1a17;
  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: 12px;
  font-weight: 900;
  color: #6c625a;
  padding-inline: 6px;
}

.admin-sidebar-link,
.admin-sidebar-logout {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #1f1a17;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  font-weight: 800;
  cursor: pointer;
}

.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:hover,
.admin-sidebar-logout:hover {
  border-color: #dbe1e7;
  background: #f8fafc;
}

.admin-sidebar-link.active {
  border-color: rgba(239, 68, 68, 0.35);
  background: #fee2e2;
  color: #b91c1c;
}

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

.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;
}

@media (max-width: 760px) {
  body.admin-ui {
    min-height: 100dvh;
    padding: 18px 12px 24px !important;
  }

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

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

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

  body.admin-ui.cashier-theme .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 .topbar > .actions .btn {
    width: 100%;
  }

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

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

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

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

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

  body.admin-ui .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-sidebar-width: 100%;
    --admin-sidebar-gap: 12px;
  }

  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 {
    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 .topbar .actions {
    grid-template-columns: 1fr;
  }

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