:root {
  --bg: #f6f7fb;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e6eaf2;

  --primary: #2a69b8;
  --primary-hover: #245fa8;
  --primary-active: #1b4a82;

  --focus: rgba(42, 105, 184, 0.12);
  --shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  --shadow-sm: 0 6px 18px rgba(17, 24, 39, 0.1);

  --radius: 12px;
}

html {
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  width: min(1520px, calc(100% - 56px));
  margin: 0 auto;
}

body.tablet-portrait-lock {
  overflow: hidden;
}

.rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: radial-gradient(circle at 20% 20%, #1f4f8a, #0f172a);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.tablet-portrait-lock .rotate-overlay {
  display: flex;
}

.rotate-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 18px;
  text-align: center;
  padding: 24px 20px;
  box-shadow: 0 16px 40px rgba(2, 6, 23, 0.45);
}

.rotate-icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 12px;
}

.rotate-card h2 {
  margin: 0 0 8px;
  font-size: 25px;
  color: #0f172a;
}

.rotate-card p {
  margin: 0;
  color: #334155;
  font-size: 16px;
  line-height: 1.4;
}
@media (max-width: 700px) {
  .wrap {
    width: calc(100% - 24px);
  }
}

/* Header */
header {
  padding: 18px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 52px;
}

.header-slot {
  min-width: 0;
}

.admin-link-btn {
  white-space: nowrap;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Hero */
.hero-inner {
  text-align: center;
}
.hero-title {
  margin: 10px 0 6px;
}
.hero-sub {
  margin: 0 auto;
  max-width: 920px;
  color: var(--muted);
  padding: 4px;
}

main {
  padding: 18px 0 26px;
}

/* Panels */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin: 0;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  text-align: center;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px;
  align-items: center;
}

#preparedAddBtn {
  white-space: nowrap;
}

input[type="search"] {
  flex: 1;
  min-width: 320px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

/* Hide number arrows (optional) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  appearance: textfield;
}

textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  margin-top: 6px;
}

input,
textarea {
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  touch-action: manipulation;
}
input:hover,
textarea:hover {
  border-color: #cfd5df;
}
input:focus,
textarea:focus {
  border-color: rgba(42, 105, 184, 0.55);
  box-shadow: 0 0 0 3px var(--focus);
}

/* Buttons */
button,
.btn {
  padding: 10px 12px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
  touch-action: manipulation;
}

button:hover,
.btn:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
button:active,
.btn:active {
  transform: translateY(0);
  box-shadow: none;
  background: var(--primary-active);
  border-color: var(--primary-active);
}
button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button.secondary,
.btn.ghost {
  background: #fff;
  color: var(--primary);
  border-color: rgba(42, 105, 184, 0.35);
}
button.secondary:hover,
.btn.ghost:hover {
  background: rgba(42, 105, 184, 0.06);
  border-color: rgba(42, 105, 184, 0.55);
}

/* Small / pill */
.small {
  font-size: 12px;
  color: var(--muted);
}
.pill {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

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

/* ✅ Layout grid (catalog left, cart right) */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
  margin-top: 14px;
}
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* Status line */
.status {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}
.status:empty {
  display: none;
}

/* Catalog table */
.catalog-table-wrap {
  padding-top: 5px;
  overflow: hidden;
}
.catalog-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.catalog-table thead th {
  border-bottom: 1px solid var(--line);
  background: #dbe7f7;
  color: #0f172a;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 10px 12px;
}

.catalog-table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: middle;
  font-size: 13px;
}

.catalog-table tbody tr:nth-child(even) {
  background: #fafafa;
}
.catalog-table tbody tr:hover {
  background: rgba(42, 105, 184, 0.06);
}

.th-code {
  width: 92px;
}
.th-pack {
  width: 76px;
}
.th-color {
  width: 120px;
}
.th-bundle {
  width: 120px;
}
.th-packs {
  width: 170px;
}
.th-qty {
  width: 300px;
}

.td-code {
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
  position: relative;
}

.history-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
  line-height: 1;
  vertical-align: middle;
}

.history-badge.never-ordered {
  color: #d1d5db;
  opacity: 0.5;
}

.history-badge.once-ordered {
  color: #f59e0b;
}

.history-badge.many-times-ordered {
  color: #10b981;
  font-weight: 600;
}

.td-desc {
  text-align: left;
  min-width: 0;
}

/* wrap + clamp description */
.td-desc > div {
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.td-pack,
.td-color,
.td-bundle,
.td-packs,
.td-qty {
  text-align: center;
}

.td-color {
  font-weight: 700;
  white-space: nowrap;
}

.packshot {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.bundle-pill {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: #334155;
}

.qty-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stepBtn {
  width: 20px;
  height: 16px;
  min-width: 20px;
  padding: 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.stepBtn:hover {
  transform: none;
  box-shadow: none;
}

/* Desktop-only: make +/- controls more discreet */
@media (min-width: 1101px) {
  .th-desc {
    width: 20%;
  }

  .th-packs {
    width: 130px;
  }

  .stepBtn {
    width: 12px;
    height: 12px;
    min-width: 12px;
    font-size: 8px;
    border-radius: 4px;
  }

  .qty-stepper {
    gap: 2px;
  }
}

.td-packs input,
.qty-inline input {
  width: 84px;
  height: 36px;
  padding: 6px 10px;
  border-radius: 12px;
  text-align: center;
}

.qty-inline button {
  height: 36px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  min-width: 80px;
  white-space: nowrap;
}

/* Keep the TEM./SYSK. and SYSKEYASIES columns visually closer */
.th-bundle,
.td-bundle {
  padding-right: 0.2rem !important;
}

.th-packs,
.td-packs {
  padding-left: 0.2rem !important;
}

/* Cart */
.actions {
  padding: 14px;
  text-align: left;
}

.actions .customerName,
.actions .customerSubstore,
.actions .customerEmail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding-bottom: 14px;
}
.actions .customerName input,
.actions .customerSubstore input,
.actions .customerEmail input {
  width: 100%;
}

.actions .customerName label,
.actions .customerSubstore label,
.actions .customerEmail label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.actions .cartLabel,
.actions .notesField,
.actions .buttons,
.actions .submitStatus {
  margin-top: 12px;
}

.actions .cartLabel {
  font-weight: 700;
  margin-bottom: 6px;
}

.actions .notesField {
  display: grid;
  gap: 6px;
}

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

.cart {
  padding: 0;
}

.cartItem {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.cartItem:last-child {
  border-bottom: none;
}

.cartLeft {
  min-width: 0;
}

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

.cartTitle {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cartCode {
  font-size: 12px;
  color: var(--muted);
}
.cartQtyEditor {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cartQtyInput {
  width: 76px;
  text-align: center;
  padding: 8px 10px;
}

.cartStepBtn {
  min-width: 40px;
  padding: 8px 10px;
}

.buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  justify-content: center;
}

/* ✅ Pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.pager .meta {
  font-size: 12px;
  color: var(--muted);
}
.pager .left {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ✅ Toolbar message "toast" (κάτω από την toolbar) */
.toast {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f6f7fb;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.35;
  display: none;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.08);
}

.toast.show {
  display: flex;
  animation: toastIn 180ms ease-out;
}

.toast .icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.toast .text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast.is-error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #7f1d1d;
}

.toast.is-ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
}

.toast.is-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.modal.open {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-card {
  position: relative;
  max-width: min(920px, 92vw);
  max-height: 86vh;
  margin: 6vh auto 0;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.modal-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
  background: #fff;
}
.modal-cap {
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  border-top: 1px solid var(--line);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.modal-close:hover {
  background: #f7f9fc;
}

/* Submit modal tweaks */
.submit-card {
  max-width: 520px;
  position: relative;
  padding-top: 6px;
}

.modal-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
}

.modal-body {
  padding: 14px 16px;
  color: #334155;
  font-size: 14px;
  text-align: left;
}

.modal-actions {
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.1);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease,
    border-color 0.12s ease;
}

.modal-x::before,
.modal-x::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  background: #334155;
  border-radius: 2px;
}

.modal-x::before {
  transform: rotate(45deg);
}
.modal-x::after {
  transform: rotate(-45deg);
}

.modal-x:hover {
  transform: translateY(-1px);
  background: rgba(42, 105, 184, 0.06);
  border-color: rgba(42, 105, 184, 0.35);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.14);
}

.modal-x:focus {
  outline: none;
  box-shadow:
    0 0 0 3px var(--focus),
    0 10px 22px rgba(17, 24, 39, 0.12);
}

/* Footer */
.site-footer {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-inner {
  padding: 14px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer-text {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.footer-text strong {
  color: var(--text);
  font-weight: 800;
}

/* Table scroll on small screens */
@media (max-width: 980px) {
  .catalog-table-wrap {
    overflow: auto;
  }
  .catalog-table {
    min-width: 900px;
  }
}

/* Tablet landscape: scale using rem/clamp, no fixed viewport hacks */
@media (min-width: 700px) and (max-width: 1366px) and (orientation: landscape) {
  html {
    font-size: clamp(13px, 1.2vw, 15px);
  }

  .wrap {
    width: calc(100% - 2rem);
  }

  header {
    padding: 0.75rem 1rem;
  }

  .brand-logo {
    height: 2rem;
  }

  main {
    padding: 0.75rem 0 1rem;
  }

  .hero-title {
    margin: 0.4rem 0 0.3rem;
    font-size: 1.55rem;
  }

  .hero-sub {
    max-width: 62rem;
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }

  .toolbar {
    gap: 0.5rem;
    margin: 0.5rem;
  }

  input[type="search"] {
    min-width: 16rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.88rem;
  }

  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  textarea {
    padding: 0.55rem 0.65rem;
    font-size: 0.88rem;
  }

  button,
  .btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
  }

  .catalog-table-wrap {
    overflow-x: hidden;
  }

  .catalog-table {
    table-layout: fixed;
    min-width: 0;
    width: 100%;
  }

  .th-code {
    width: 3rem;
  }

  .th-pack {
    width: 4.4rem;
  }

  .th-color {
    width: 6rem;
  }

  .th-bundle {
    width: 2.5rem;
  }

  .th-packs {
    width: 4.7rem;
  }

  .th-packs,
  .td-packs {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .th-bundle,
  .td-bundle {
    padding-right: 0 !important;
  }

  .th-qty {
    width: 7rem;
  }

  .th-desc {
    width: 16%;
  }

  .th-desc,
  .td-desc {
    min-width: 0;
  }

  .th-desc,
  .td-desc {
    padding-right: 0.08rem !important;
  }

  .th-pack,
  .td-pack {
    padding-left: 0.08rem !important;
  }

  .th-bundle,
  .td-bundle,
  .th-packs,
  .td-packs,
  .th-qty,
  .td-qty {
    padding-left: 0.01rem !important;
  }

  .catalog-table thead th {
    font-size: 0.68rem;
    padding: 0.36rem 0.38rem;
  }

  .catalog-table tbody td {
    padding: 0.22rem 0.28rem;
    font-size: 0.75rem;
  }

  .packshot {
    width: 2.8rem;
    height: 2.8rem;
  }

  .td-packs input,
  .qty-inline input {
    width: 2.55rem;
    height: 1.7rem;
    padding: 0.15rem;
  }

  .qty-inline button {
    height: 1.95rem;
    min-width: 3.2rem;
    font-size: 0.62rem;
  }

  .stepBtn {
    width: 1.05rem;
    height: 1rem;
    min-width: 1.05rem;
    font-size: 0.78rem;
    border-radius: 0.3rem;
    padding: 0;
  }

  .qty-inline {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
  }

  .qty-stepper {
    justify-content: center;
    width: auto;
  }

  .qty-inline .addBtn {
    width: auto;
    min-width: 3.2rem;
    padding-left: 0.28rem;
    padding-right: 0.28rem;
    flex: 0 0 auto;
  }

  .actions {
    padding: 0.75rem;
  }

  .actions .customerName,
  .actions .customerEmail {
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
  }

  .cartItem {
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .cartTitle,
  .cartQty {
    font-size: 0.78rem;
  }

  .cartCode {
    font-size: 0.72rem;
  }

  .buttons {
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .pager {
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }

  .pager .meta {
    font-size: 0.72rem;
  }
}

@media (min-width: 700px) and (max-width: 1100px) and (orientation: landscape) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   Darker catalog background
   + stronger inputs
   ========================= */

/* Σκοτείνιασε μόνο το panel του καταλόγου (αριστερά) */
.grid > section.panel {
  background: #f1f4f9; /* πιο σκούρο από το λευκό */
}

/* Λίγο πιο σκούρα zebra rows για contrast */
.catalog-table tbody tr:nth-child(even) {
  background: #eaf0f9;
}

/* Hover να ξεχωρίζει */
.catalog-table tbody tr:hover {
  background: rgba(42, 105, 184, 0.12);
}

/* Inputs μέσα στον κατάλογο: να “φαίνονται” */
.td-packs input,
.qty-inline input {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.22);
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.08);
}

/* Όταν κάνουν focus, πιο έντονο highlight */
.td-packs input:focus,
.qty-inline input:focus {
  border-color: rgba(42, 105, 184, 0.75);
  box-shadow:
    0 0 0 3px var(--focus),
    0 4px 14px rgba(17, 24, 39, 0.12);
}

/* Κουμπί “Προσθήκη” στο table να φαίνεται λίγο πιο “flat” δίπλα στα inputs */
.qty-inline .addBtn {
  box-shadow: none;
}

/* Image modal close button να φαίνεται πάντα */
#imgModal .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 50;

  width: 42px;
  height: 42px;
  border-radius: 999px;

  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: #0f172a;

  font-size: 26px;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

#imgModal .modal-close:hover {
  transform: translateY(-1px);
  background: #fff;
}

/* Admin */
.admin-body {
  background:
    radial-gradient(
      circle at top left,
      rgba(42, 105, 184, 0.12),
      transparent 24%
    ),
    linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
}

.admin-body .wrap {
  width: min(1680px, calc(100% - 40px));
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-hero {
  padding-top: 8px;
}

.admin-eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.admin-topbar {
  gap: 16px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-panel {
  overflow: visible;
}

.admin-customer-hero {
  border-color: rgba(42, 105, 184, 0.18);
  background:
    radial-gradient(
      circle at top right,
      rgba(42, 105, 184, 0.08),
      transparent 32%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.99),
      rgba(243, 247, 252, 0.99)
    );
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.admin-customer-hero .panel-head {
  padding-bottom: 14px;
  background: linear-gradient(
    180deg,
    rgba(233, 242, 254, 0.95),
    rgba(248, 251, 255, 0.7)
  );
  border-bottom: 1px solid rgba(42, 105, 184, 0.12);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}

.panel-head-inline {
  align-items: center;
}

.panel-head > div:first-child {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.panel-head h2,
.admin-empty-state h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
}

.panel-head p,
.admin-empty-state p {
  margin: 0;
  color: var(--muted);
}

.admin-customer-hero .panel-head h2 {
  font-size: 28px;
  line-height: 1.1;
}

.admin-customer-meta {
  font-size: 14px;
  color: #334155 !important;
  font-weight: 600;
}

.admin-panel-subtle {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.admin-panel-subtle .panel-head {
  padding-bottom: 8px;
}

.admin-panel-note {
  max-width: 52ch;
  font-size: 12px;
  line-height: 1.45;
  color: #64748b !important;
}

.admin-toast {
  margin-top: 0;
}

.admin-login-panel {
  width: min(640px, 100%);
  justify-self: center;
}

.admin-form-grid {
  display: grid;
  gap: 14px;
  padding: 10px 18px 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.field-grow {
  min-width: 0;
}

.admin-login-actions {
  display: flex;
  justify-content: flex-end;
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.admin-searchbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px 18px;
}

.admin-searchbar .field-grow {
  flex: 1 1 240px;
}

.admin-search-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

.admin-search-results {
  padding: 0 18px 18px;
}

.admin-search-results .admin-table-wrap {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.admin-search-results .admin-table {
  width: 1400px;
  max-width: 100%;
  margin: 0 auto;
  table-layout: fixed;
  white-space: nowrap;
}

.admin-search-results .admin-table th:nth-child(1),
.admin-search-results .admin-table td:nth-child(1) {
  width: 140px;
}

.admin-search-results .admin-table th:nth-child(2),
.admin-search-results .admin-table td:nth-child(2) {
  width: 300px;
  padding-right: 26px;
}

.admin-search-results .admin-table th:nth-child(3),
.admin-search-results .admin-table td:nth-child(3) {
  width: 320px;
  padding-left: 26px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-search-results .admin-table th:nth-child(4),
.admin-search-results .admin-table td:nth-child(4) {
  width: 130px;
  text-align: center;
}

.admin-loading-indicator {
  margin: 0 18px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(42, 105, 184, 0.2);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(239, 246, 255, 0.98),
    rgba(247, 250, 255, 0.98)
  );
  color: #1e3a8a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.admin-loading-indicator[hidden] {
  display: none;
}

.admin-loading-indicator-sticky {
  position: sticky;
  top: 86px;
  z-index: 3;
  margin-bottom: 0;
}

.admin-loading-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(42, 105, 184, 0.2);
  border-top-color: var(--primary);
  animation: adminSpin 0.8s linear infinite;
  flex: 0 0 auto;
}

.admin-loading-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.admin-stats-stack.is-loading {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

.admin-search-results.is-loading .admin-table-wrap,
.admin-stats-stack.is-loading .panel {
  pointer-events: none;
}

.admin-panel.is-collapsed {
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.admin-search-suggestions {
  padding: 0 18px 12px;
}

.admin-search-suggestions-list {
  display: grid;
  gap: 8px;
}

.admin-search-suggestion {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(42, 105, 184, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  text-align: left;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.admin-search-suggestion.is-active {
  border-color: rgba(42, 105, 184, 0.4);
  background: rgba(231, 240, 255, 0.9);
}

.admin-search-suggestion strong {
  color: #0f172a;
  font-size: 14px;
}

.admin-search-suggestion-meta {
  color: var(--muted);
  font-size: 12px;
}

.admin-result-select {
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.admin-empty-state {
  padding: 28px 22px;
  text-align: center;
}

.admin-stats-stack {
  display: grid;
  gap: 18px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 4px 18px 18px;
}

.admin-stat-card {
  padding: 16px 18px;
  border: 1px solid rgba(42, 105, 184, 0.14);
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(244, 247, 252, 0.98)
  );
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.admin-stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.admin-stat-range {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.admin-stat-range select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.1;
}

.admin-customer-hero .admin-stat-card {
  border-color: rgba(42, 105, 184, 0.16);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 1),
    rgba(239, 245, 252, 1)
  );
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.admin-stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.admin-stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1.1;
  color: #0f172a;
}

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

.admin-results-grid-wide {
  margin-bottom: 18px;
}

.admin-mini-stat-grid {
  display: block;
  padding-top: 0;
}

#receivablesPanel .admin-stat-card {
  margin: 0 auto;
  width: min(100%, 300px);
}

#receivablesPanel .admin-top-qty-table {
  table-layout: fixed;
}

#receivablesPanel .admin-top-qty-table th:nth-child(1),
#receivablesPanel .admin-top-qty-table td:nth-child(1) {
  width: 14%;
}

#receivablesPanel .admin-top-qty-table th:nth-child(2),
#receivablesPanel .admin-top-qty-table td:nth-child(2) {
  width: 18%;
}

#receivablesPanel .admin-top-qty-table th:nth-child(3),
#receivablesPanel .admin-top-qty-table td:nth-child(3) {
  width: 42%;
}

#receivablesPanel .admin-top-qty-table th:nth-child(4),
#receivablesPanel .admin-top-qty-table td:nth-child(4),
#receivablesPanel .admin-top-qty-table th:nth-child(5),
#receivablesPanel .admin-top-qty-table td:nth-child(5) {
  width: 13%;
}

#receivablesPanel .admin-top-qty-table th:nth-child(6),
#receivablesPanel .admin-top-qty-table td:nth-child(6) {
  display: none;
}

.admin-inline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-compact-field {
  min-width: 180px;
}

.admin-compact-field input[type="search"],
.admin-compact-field select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.admin-compact-field input[type="search"] {
  min-width: 260px;
}

.admin-monthly-table th,
.admin-monthly-table td {
  white-space: nowrap;
}

.admin-monthly-table th:first-child,
.admin-monthly-table td:first-child {
  width: 22%;
}

.admin-monthly-table .admin-monthly-total-heading,
.admin-monthly-table .admin-monthly-total-cell {
  background: #e7f0ea;
  font-weight: 800;
}

.admin-monthly-table tbody tr:nth-child(even) .admin-monthly-total-cell {
  background: #deebe2;
}

.admin-monthly-table tfoot td {
  background: #edf4ef;
  font-weight: 800;
  border-top: 1px solid #cfddd2;
}

.admin-table-number {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

#detailedOrdersList .admin-table {
  table-layout: fixed;
}

#detailedOrdersList .admin-table th:nth-child(1),
#detailedOrdersList .admin-table td:nth-child(1) {
  width: 110px;
}

#detailedOrdersList .admin-table th:nth-child(2),
#detailedOrdersList .admin-table td:nth-child(2) {
  width: 280px;
}

#detailedOrdersList .admin-table th:nth-child(3),
#detailedOrdersList .admin-table td:nth-child(3),
#detailedOrdersList .admin-table th:nth-child(4),
#detailedOrdersList .admin-table td:nth-child(4),
#detailedOrdersList .admin-table th:nth-child(5),
#detailedOrdersList .admin-table td:nth-child(5),
#detailedOrdersList .admin-table th:nth-child(6),
#detailedOrdersList .admin-table td:nth-child(6) {
  width: auto;
}

.admin-table-action {
  text-align: center;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 18px 18px;
}

.admin-pagination-meta {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.admin-table-wrap {
  padding: 0 18px 18px;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

.admin-table th {
  background: #e7edf7;
  color: #0f172a;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.admin-panel-subtle .admin-table th {
  background: #edf2f8;
}

.admin-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.admin-sort-btn-number {
  justify-content: flex-end;
  width: 100%;
}

.admin-sort-indicator {
  font-size: 11px;
  opacity: 0.85;
}

.admin-product-sales-table {
  table-layout: auto;
}

.admin-product-sales-table th:nth-child(1),
.admin-product-sales-table td:nth-child(1) {
  width: 14%;
}

.admin-product-sales-table th:nth-child(2),
.admin-product-sales-table td:nth-child(2) {
  width: 24%;
}

.admin-product-sales-table th:nth-child(3),
.admin-product-sales-table td:nth-child(3),
.admin-product-sales-table th:nth-child(4),
.admin-product-sales-table td:nth-child(4),
.admin-product-sales-table th:nth-child(5),
.admin-product-sales-table td:nth-child(5),
.admin-product-sales-table th:nth-child(6),
.admin-product-sales-table td:nth-child(6) {
  width: 15.5%;
}

.admin-table-filter-row th {
  padding-top: 8px;
  padding-bottom: 8px;
  background: #f5f8fc;
  text-transform: none;
  letter-spacing: 0;
}

.admin-table-filter-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #cdd8e5;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.admin-table-filter-input::placeholder {
  color: var(--muted);
}

.admin-top-qty-table,
.admin-top-value-table,
.admin-recent-orders-table {
  table-layout: auto;
}

.admin-top-qty-table th:nth-child(1),
.admin-top-qty-table td:nth-child(1) {
  width: 12%;
}

.admin-top-qty-table th:nth-child(2),
.admin-top-qty-table td:nth-child(2) {
  width: 42%;
}

.admin-top-qty-table th:nth-child(3),
.admin-top-qty-table td:nth-child(3),
.admin-top-qty-table th:nth-child(4),
.admin-top-qty-table td:nth-child(4),
.admin-top-qty-table th:nth-child(5),
.admin-top-qty-table td:nth-child(5) {
  width: 15%;
}

.admin-top-value-table th:nth-child(1),
.admin-top-value-table td:nth-child(1) {
  width: 16%;
}

.admin-top-value-table th:nth-child(2),
.admin-top-value-table td:nth-child(2) {
  width: 37%;
}

.admin-top-value-table th:nth-child(3),
.admin-top-value-table td:nth-child(3) {
  width: 20%;
}

.admin-top-value-table th:nth-child(4),
.admin-top-value-table td:nth-child(4) {
  width: 12%;
}

.admin-top-value-table th:nth-child(5),
.admin-top-value-table td:nth-child(5) {
  width: 15%;
}

.admin-recent-orders-table th:nth-child(1),
.admin-recent-orders-table td:nth-child(1) {
  width: 16%;
}

.admin-recent-orders-table th:nth-child(2),
.admin-recent-orders-table td:nth-child(2) {
  width: 18%;
}

.admin-recent-orders-table th:nth-child(3),
.admin-recent-orders-table td:nth-child(3),
.admin-recent-orders-table th:nth-child(4),
.admin-recent-orders-table td:nth-child(4) {
  width: 10%;
}

.admin-recent-orders-table th:nth-child(5),
.admin-recent-orders-table td:nth-child(5) {
  width: 8%;
}

.admin-recent-orders-table th:nth-child(6),
.admin-recent-orders-table td:nth-child(6) {
  width: 8%;
}

.admin-recent-orders-table th:nth-child(7),
.admin-recent-orders-table td:nth-child(7) {
  width: 10%;
}

.admin-recent-orders-table th:nth-child(8),
.admin-recent-orders-table td:nth-child(8) {
  width: 10%;
}

.admin-recent-orders-table th:nth-child(9),
.admin-recent-orders-table td:nth-child(9) {
  width: 12%;
}

.admin-recent-orders-table {
  table-layout: fixed;
}

.admin-recent-orders-table .admin-sort-btn {
  width: 100%;
}

.admin-open-orders-table th:nth-child(1),
.admin-open-orders-table td:nth-child(1),
.admin-pre-approval-orders-table th:nth-child(1),
.admin-pre-approval-orders-table td:nth-child(1) {
  width: 16%;
}

.admin-open-orders-table th:nth-child(2),
.admin-open-orders-table td:nth-child(2),
.admin-pre-approval-orders-table th:nth-child(2),
.admin-pre-approval-orders-table td:nth-child(2) {
  width: 16%;
}

.admin-open-orders-table th:nth-child(3),
.admin-open-orders-table td:nth-child(3),
.admin-pre-approval-orders-table th:nth-child(3),
.admin-pre-approval-orders-table td:nth-child(3) {
  width: 10%;
}

.admin-open-orders-table th:nth-child(4),
.admin-open-orders-table td:nth-child(4),
.admin-pre-approval-orders-table th:nth-child(4),
.admin-pre-approval-orders-table td:nth-child(4) {
  width: 10%;
}

.admin-open-orders-table th:nth-child(5),
.admin-open-orders-table td:nth-child(5),
.admin-pre-approval-orders-table th:nth-child(5),
.admin-pre-approval-orders-table td:nth-child(5) {
  width: 8%;
}

.admin-open-orders-table th:nth-child(6),
.admin-open-orders-table td:nth-child(6),
.admin-pre-approval-orders-table th:nth-child(6),
.admin-pre-approval-orders-table td:nth-child(6) {
  width: 10%;
}

.admin-open-orders-table th:nth-child(7),
.admin-open-orders-table td:nth-child(7),
.admin-pre-approval-orders-table th:nth-child(7),
.admin-pre-approval-orders-table td:nth-child(7) {
  width: 10%;
}

.admin-open-orders-table th:nth-child(8),
.admin-open-orders-table td:nth-child(8),
.admin-pre-approval-orders-table th:nth-child(8),
.admin-pre-approval-orders-table td:nth-child(8) {
  width: 10%;
}

.admin-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.admin-table-empty {
  color: var(--muted);
  text-align: center !important;
}

@keyframes adminSpin {
  to {
    transform: rotate(360deg);
  }
}

.admin-number-negative {
  color: #d92d20;
  font-weight: 800;
}

.admin-order-select {
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.admin-order-select.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.admin-order-stack {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.admin-order-card {
  border: 1px solid rgba(42, 105, 184, 0.14);
  border-radius: 16px;
  background: #fbfdff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.admin-order-card-active {
  border-color: rgba(42, 105, 184, 0.4);
  box-shadow: 0 14px 34px rgba(42, 105, 184, 0.12);
}

.admin-order-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.admin-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 8px;
}

.admin-order-head h3 {
  margin: 0;
  font-size: 18px;
}

.admin-order-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-order-kpis {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

.admin-order-kpi-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.admin-order-kpis strong {
  font-size: 18px;
  color: #0f172a;
}

.admin-order-open-link {
  flex: 0 0 auto;
  margin-left: 0;
  font-size: 14px;
  white-space: nowrap;
}

.admin-order-note,
.admin-order-meta {
  padding: 0 18px 10px;
  color: #475569;
  font-size: 13px;
}

.admin-order-table-wrap {
  padding-top: 0;
}

@media (max-width: 980px) {
  .admin-body .wrap {
    width: calc(100% - 24px);
  }

  .admin-stat-grid,
  .admin-results-grid {
    grid-template-columns: 1fr;
  }

  .admin-mini-stat-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar,
  .header-bar {
    grid-template-columns: 1fr;
  }

  .header-slot {
    display: none;
  }

  .brand,
  .header-actions,
  .admin-topbar-actions {
    width: 100%;
    justify-content: center;
  }

  .admin-searchbar {
    align-items: stretch;
  }

  .admin-search-actions {
    width: 100%;
    justify-content: stretch;
  }

  .admin-search-actions > * {
    flex: 1;
  }

  .admin-order-head {
    flex-direction: column;
  }

  .admin-order-kpis {
    justify-content: flex-start;
  }

  .admin-inline-controls,
  .admin-compact-field {
    width: 100%;
  }
}

@media (min-width: 700px) and (max-width: 1366px) and (orientation: landscape) {
  .admin-body .wrap {
    width: calc(100% - 2rem);
  }

  .admin-shell {
    gap: 0.85rem;
  }

  .admin-topbar-actions {
    gap: 0.5rem;
  }

  .panel-head {
    padding: 0.9rem 0.95rem 0.35rem;
  }

  .admin-searchbar,
  .admin-form-grid,
  .admin-stat-grid,
  .admin-table-wrap,
  .admin-order-stack {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  .admin-searchbar,
  .admin-form-grid {
    padding-bottom: 0.95rem;
  }

  .admin-stat-grid {
    gap: 0.55rem;
    padding-bottom: 0.95rem;
  }

  .admin-stat-card {
    padding: 0.85rem 0.9rem;
    border-radius: 0.95rem;
  }

  .admin-stat-card strong {
    font-size: 1.5rem;
  }

  .admin-results-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 0.5rem 0.55rem;
    font-size: 0.78rem;
  }

  .admin-table th {
    font-size: 0.68rem;
  }

  .admin-empty-state {
    padding: 1.1rem;
  }

  .admin-order-card {
    border-radius: 0.95rem;
  }

  .admin-order-head {
    padding: 0.9rem 0.95rem 0.35rem;
  }

  .admin-order-note,
  .admin-order-meta {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
    padding-bottom: 0.5rem;
    font-size: 0.76rem;
  }
}
