/* ============================================================
   ADMIN BACKOFFICE LIGHT LUXURY STYLESHEET - TENUTE ANCONA
   ============================================================ */

:root {
  --olive:     #4a5c22;
  --olive-dk:  #303d16;
  --gold:      #b8892a;
  --gold-lt:   #d4aa55;
  --gold-pale: #e8d49a;
  --cream:     #faf8f3;
  --cream-dk:  #f0ebe0;
  --ink:       #1a1208;
  --ink-md:    #4a3c28;
  --ink-lt:    #8a7055;
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
}

.admin-body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Jost', sans-serif;
  min-height: 100vh;
  margin: 0;
  line-height: 1.6;
}

.admin-screen {
  min-height: 100vh;
}

/* LOGIN CARD LIGHT THEME */
#loginScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dk) 100%);
  padding: 1.5rem;
}

.login-card {
  background: #ffffff;
  border: 1px solid rgba(184, 137, 42, 0.3);
  padding: 3rem 2.5rem;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 15px 35px rgba(26, 18, 8, 0.08);
  text-align: center;
}

.login-card .brand-header {
  margin-bottom: 2rem;
}

.login-card .logo-main {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  color: var(--gold);
  display: block;
}

.login-card .subtitle {
  font-size: 0.85rem;
  color: var(--ink-lt);
  margin-top: 0.3rem;
}

.admin-form .field-group {
  margin-bottom: 1.5rem;
  position: relative;
  text-align: left;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  background: var(--cream);
  border: 1px solid rgba(26, 18, 8, 0.15);
  color: var(--ink);
  padding: 0.9rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 137, 42, 0.15);
}

.login-footer {
  margin-top: 1.5rem;
}

.login-footer a {
  color: var(--gold);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* HEADER LIGHT THEME */
.admin-header {
  background: #ffffff;
  border-bottom: 1px solid rgba(26, 18, 8, 0.08);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.admin-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1560px;
  width: 95%;
  margin: 0 auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-brand .logo-main {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: var(--gold);
  font-weight: 500;
}

.badge-admin {
  background: rgba(184, 137, 42, 0.12);
  color: var(--gold);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  border: 1px solid rgba(184, 137, 42, 0.3);
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--ink-md);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

#logoutBtn,
.btn-sm.btn-ghost {
  background: var(--cream-dk) !important;
  color: var(--ink-md) !important;
  border: 1px solid rgba(26, 18, 8, 0.2) !important;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#logoutBtn:hover,
.btn-sm.btn-ghost:hover {
  background: rgba(229, 62, 62, 0.12) !important;
  color: #c53030 !important;
  border-color: rgba(229, 62, 62, 0.4) !important;
}

/* MAIN CONTENT LIGHT THEME */
.admin-content {
  max-width: 1560px;
  width: 95%;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* STATS ROW LIGHT THEME */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid rgba(26, 18, 8, 0.08);
  border-radius: 12px;
  padding: 1.6rem 1.8rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
}

.stat-card.highlight-warn {
  border-color: rgba(229, 62, 62, 0.3);
  background: #fffafa;
}

/* Featured read-only figure, such as the waiting list "Stima totale": spans the whole row of the grid. */
.stat-card.stat-card-featured {
  grid-column: 1 / -1;
  border-color: var(--gold);
  background: #fffdf5;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-lt);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
}

.status-badge {
  font-size: 1rem;
  color: var(--olive);
}

/* ACTION BAR LIGHT THEME */
.admin-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-wrap input {
  background: #ffffff;
  border: 1px solid rgba(26, 18, 8, 0.15);
  color: var(--ink);
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  min-width: 280px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--gold);
}

.action-btns {
  display: flex;
  gap: 0.8rem;
}

/* TABLE CARD LIGHT THEME */
.table-card {
  background: #ffffff;
  border: 1px solid rgba(26, 18, 8, 0.08);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th,
.admin-table td {
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid rgba(26, 18, 8, 0.06);
}

.admin-table th {
  background: var(--cream-dk);
  color: var(--olive-dk);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table tbody tr:hover {
  background: var(--cream);
}

.table-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(184, 137, 42, 0.3);
  background: #f0ebe0;
}

.stock-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stock-input {
  width: 60px;
  padding: 0.4rem;
  text-align: center;
  background: var(--cream);
  border: 1px solid rgba(26, 18, 8, 0.2);
  color: var(--ink);
  border-radius: 4px;
  font-weight: 600;
}

/* Pre-order lots: form section and the sold counter that replaces the stock buttons in the list */
.preorder-section {
  border: 1px solid rgba(184, 137, 42, 0.35);
  border-radius: 8px;
  background: rgba(184, 137, 42, 0.05);
  padding: 0.6rem 1.1rem 1rem;
  margin: 0 0 1.4rem;
}

.preorder-section legend {
  padding: 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-modal .preorder-toggle {
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  margin: 0.4rem 0 0.8rem !important;
}

.preorder-toggle input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--gold);
}

.preorder-hint {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-lt);
  margin: 0 0 1rem;
}

.preorder-sold {
  font-weight: 600;
  white-space: nowrap;
}

.badge-status {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-status.active {
  background: rgba(74, 92, 34, 0.12);
  color: var(--olive);
}

.badge-status.low {
  background: rgba(237, 137, 54, 0.15);
  color: #c05621;
}

.badge-status.out {
  background: rgba(245, 101, 101, 0.15);
  color: #c53030;
}

/* MODAL OVERLAY AND FORM LIGHT THEME FIX */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 8, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.admin-modal {
  max-width: 780px;
  width: 94%;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(184, 137, 42, 0.3);
  border-radius: 14px;
  color: var(--ink);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  padding: 0;
}

.admin-modal .modal-header {
  background: var(--cream-dk);
  border-bottom: 1px solid rgba(26, 18, 8, 0.08);
  padding: 1.2rem 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

.admin-modal .modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin: 0;
}

.admin-modal .modal-body {
  padding: 1.8rem;
}

.admin-modal .field-group {
  margin-bottom: 1.2rem;
  position: static !important;
  text-align: left;
}

.admin-modal label,
.admin-form label {
  position: static !important;
  transform: none !important;
  display: block !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: var(--gold) !important;
  margin-bottom: 0.35rem !important;
  opacity: 1 !important;
}

.admin-modal input[type="text"],
.admin-modal input[type="number"],
.admin-modal input[type="datetime-local"],
.admin-modal textarea,
.admin-modal select {
  width: 100%;
  background: var(--cream);
  border: 1px solid rgba(26, 18, 8, 0.18);
  color: var(--ink);
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  box-sizing: border-box;
}

.admin-modal input:focus,
.admin-modal textarea:focus,
.admin-modal select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 137, 42, 0.15);
}

.file-upload-box {
  background: var(--cream);
  border: 2px dashed rgba(184, 137, 42, 0.4);
  padding: 1.2rem;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
}

.file-upload-box:hover {
  background: var(--cream-dk);
}

.file-upload-box input[type="file"] {
  display: none;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-md);
  font-size: 0.9rem;
  cursor: pointer;
}

.file-upload-label span.upload-icon {
  font-size: 1.5rem;
}

.image-preview-wrap {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.image-preview-wrap img {
  max-width: 90px;
  max-height: 90px;
  border-radius: 6px;
  border: 1px solid var(--gold);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(26, 18, 8, 0.08);
}

.error-text {
  color: #c53030;
  font-size: 0.85rem;
  margin-top: 0.8rem;
}

/* ===== ADMIN TABS ===== */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(26, 18, 8, 0.08);
  padding-bottom: 0.2rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-lt);
  border-radius: 8px 8px 0 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--ink);
  background: rgba(184, 137, 42, 0.06);
}

.tab-btn.active {
  color: var(--olive-dk);
  background: #ffffff;
  border-bottom: 3px solid var(--gold);
}

.tab-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 99px;
  background: rgba(184, 137, 42, 0.15);
  color: var(--gold-dk);
}

.tab-btn.active .tab-badge {
  background: var(--gold);
  color: #ffffff;
}

/* ===== ORDERS VIEW STYLING ===== */
.order-customer-box {
  line-height: 1.4;
}

.order-customer-box strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.order-customer-box small {
  color: var(--ink-lt);
  display: block;
}

.order-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.order-items-list li {
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(26, 18, 8, 0.08);
  color: var(--ink-md);
}

.order-items-list li:last-child {
  border-bottom: none;
}

.order-items-list .item-qty {
  font-weight: 700;
  color: var(--olive-dk);
  background: rgba(74, 92, 34, 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.3rem;
}

.status-select {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(26, 18, 8, 0.15);
  background: #ffffff;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.status-select.pending {
  background: #fef7e0;
  color: #b06000;
  border-color: #fce293;
}

.status-select.paid {
  background: #e6f4ea;
  color: #137333;
  border-color: #a8dab5;
}

.status-select.shipped {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #aecbfa;
}

.status-select.delivered {
  background: #f3e8fd;
  color: #8430ce;
  border-color: #d7aefb;
}

.status-select.cancelled {
  background: #fce8e6;
  color: #c5221f;
  border-color: #f5c2c7;
}

.status-select.refunded {
  background: #fff3e0;
  color: #e65100;
  border-color: #ffcc80;
}

.status-select.disputed {
  background: #fbe9e7;
  color: #bf360c;
  border-color: #ffab91;
  font-weight: 700;
}

.pay-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(26, 18, 8, 0.06);
  color: var(--ink-md);
  margin-top: 0.3rem;
}

/* ===== ORDER STATUS FILTERS ===== */
.orders-status-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.status-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(26, 18, 8, 0.12);
  background: #ffffff;
  color: var(--ink-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-filter-btn:hover {
  background: rgba(184, 137, 42, 0.08);
  border-color: var(--gold);
  color: var(--ink);
}

.status-filter-btn.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.status-filter-btn.filter-pending.active {
  background: #b06000;
  border-color: #b06000;
  color: #ffffff;
}

.status-filter-btn.filter-paid.active {
  background: #137333;
  border-color: #137333;
  color: #ffffff;
}

.status-filter-btn.filter-shipped.active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #ffffff;
}

.status-filter-btn.filter-delivered.active {
  background: #8430ce;
  border-color: #8430ce;
  color: #ffffff;
}

.status-filter-btn.filter-cancelled.active {
  background: #c5221f;
  border-color: #c5221f;
  color: #ffffff;
}

.status-filter-btn.filter-novello.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #ffffff;
}

.status-filter-btn.filter-pickup.active {
  background: var(--olive);
  border-color: var(--olive);
  color: #ffffff;
}

.status-filter-btn.filter-onsite.active {
  background: var(--gold-dk, #7a5a14);
  border-color: var(--gold-dk, #7a5a14);
  color: #ffffff;
}

/* Orders to be paid at the estate (pagamento in tenuta): badge, waiting days, reminder, amounts collected */
.order-onsite-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--gold);
  background: rgba(184, 137, 42, 0.12);
  color: #7a5a14;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: normal;
}

.order-onsite-waiting {
  display: block;
  margin-top: 4px;
  color: #718096;
  font-size: 0.78rem;
  white-space: normal;
  max-width: 13rem;
}

/* The reminder is text first (warning sign + words); the colour only adds emphasis */
.order-onsite-reminder {
  display: block;
  margin-top: 3px;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #fbd38d;
  background: #fffaf0;
  color: #975a16;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: normal;
  max-width: 13rem;
}

.order-onsite-collected {
  display: block;
  margin-top: 4px;
  color: var(--ink-md);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: normal;
  max-width: 13rem;
}

.order-status-final {
  display: inline-block;
  cursor: default;
}

/* Amount collected field of the status dialog */
.safety-amount-box {
  margin: 1.4rem 0;
  text-align: left;
  background: #fffaf0;
  border: 1.5px solid #fbd38d;
  border-radius: 12px;
  padding: 1.1rem 1.4rem;
}

.safety-amount-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.safety-amount-hint {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-md);
}

.safety-amount-error {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #c53030;
}

.safety-amount-error::before {
  content: "⚠️ ";
}

/* Badge of the orders collected at the estate (no shipping address) */
.order-pickup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--olive);
  background: rgba(74, 92, 34, 0.1);
  color: var(--olive-dk);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Badge and lot number of the orders that contain the novello (pre-order) */
.order-novello-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--gold);
  background: rgba(184, 137, 42, 0.12);
  color: #7a5a14;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.order-items-list .order-lot {
  display: block;
  color: #7a5a14;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.filter-count {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.07);
  font-weight: 700;
}

.status-filter-btn.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ===== TOAST NOTIFICATION BANNER ===== */
.admin-toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.admin-toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 460px;
  padding: 1rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: #ffffff;
  animation: toast-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.admin-toast.success {
  background: linear-gradient(135deg, #1e7e34, #28a745);
  border-left: 5px solid #155724;
}

.admin-toast.warning {
  background: linear-gradient(135deg, #d39e00, #ffc107);
  color: #212529;
  border-left: 5px solid #856404;
}

.admin-toast.error {
  background: linear-gradient(135deg, #bd2130, #dc3545);
  border-left: 5px solid #721c24;
}

.admin-toast .toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.75;
}

.admin-toast .toast-close:hover {
  opacity: 1;
}

/* ===== SAFETY CONFIRMATION MODAL ===== */
.safety-modal {
  max-width: 660px;
  width: 94%;
}

.safety-header {
  border-bottom: 2px solid #fed7d7;
  background: #fff5f5;
}

.safety-header h3 {
  color: #c53030;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.safety-body {
  padding: 1.5rem;
  text-align: center;
}

.safety-icon-wrap {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
}

.safety-status-change-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.4rem 0;
  padding: 1.2rem 1.5rem;
  background: var(--cream);
  border-radius: 10px;
  border: 1px solid rgba(26, 18, 8, 0.08);
}

.status-badge-preview {
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.safety-arrow {
  font-size: 1.4rem;
  color: var(--gold-dk);
}

.safety-note {
  font-size: 0.88rem;
  color: var(--ink-lt);
  margin-top: 0.6rem;
  line-height: 1.45;
}

/* Shipping Fields Box in Safety Modal */
.safety-shipping-box {
  margin: 1.4rem 0;
  text-align: left;
  background: #ebf8ff;
  border: 1.5px solid #bee3f8;
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
}

.safety-shipping-title {
  font-weight: 700;
  color: #2b6cb0;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.safety-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 0.2s;
}

.safety-input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

/* Delete Product Safety Modal */
.delete-modal .delete-header {
  background: #fff5f5;
  border-bottom: 2px solid #feb2b2;
}

.delete-modal .delete-header h3 {
  color: #e53e3e;
}

.delete-icon-wrap {
  font-size: 3rem;
  color: #e53e3e;
  animation: pulseWarning 1.2s infinite ease-in-out;
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.delete-product-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: #fff;
  border: 1px solid rgba(26, 18, 8, 0.1);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin: 1.2rem 0;
  text-align: left;
}

.delete-product-card img {
  width: 85px;
  height: 85px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(26, 18, 8, 0.08);
}

.delete-product-info h4 {
  margin: 0 0 0.35rem 0;
  font-size: 1.15rem;
  color: var(--ink);
}

.delete-product-info p {
  margin: 0.15rem 0;
  font-size: 0.9rem;
  color: var(--ink-lt);
}

.delete-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: #fff5f5;
  border: 1.5px solid #feb2b2;
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  text-align: left;
  font-size: 0.9rem;
  color: #9b2c2c;
  line-height: 1.45;
  margin-top: 1.2rem;
}

.btn-delete-danger {
  background: #e53e3e !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3) !important;
  transition: all 0.2s ease !important;
}

.btn-delete-danger:hover {
  background: #c53030 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(229, 62, 62, 0.4) !important;
}

/* File Upload Dropzone */
.file-upload-box {
  border: 2px dashed var(--gold);
  border-radius: 12px;
  background: rgba(184, 137, 42, 0.05);
  padding: 1.8rem 1.4rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.file-upload-box:hover {
  background: rgba(184, 137, 42, 0.12);
  border-color: var(--gold-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(184, 137, 42, 0.15);
}

.file-upload-box.dragover {
  background: rgba(49, 130, 206, 0.15);
  border-color: #3182ce;
  transform: scale(1.01);
}

.file-upload-content .upload-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 0.5rem;
}

.file-upload-content strong {
  font-size: 1rem;
  color: var(--ink);
  display: block;
}

.btn-browse-file {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  background: var(--gold);
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(184, 137, 42, 0.3);
  transition: all 0.2s ease;
}

.btn-browse-file:hover {
  background: var(--gold-lt);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(184, 137, 42, 0.4);
}

/* Upload Progress Bar */
.upload-progress-wrap {
  margin-top: 0.8rem;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: #edf2f7;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), #3182ce);
  border-radius: 99px;
  transition: width 0.3s ease;
  animation: progressIndeterminate 1.5s infinite linear;
}

@keyframes progressIndeterminate {
  0% { width: 10%; margin-left: 0; }
  50% { width: 60%; margin-left: 20%; }
  100% { width: 90%; margin-left: 10%; }
}

/* Order Tracking Pills in Table */
.order-tracking-info {
  margin-top: 0.45rem;
  padding: 0.35rem 0.6rem;
  background: rgba(49, 130, 206, 0.08);
  border-left: 3px solid #3182ce;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #2b6cb0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tracking-code-pill {
  font-family: monospace;
  font-weight: 700;
  background: #ffffff;
  padding: 0.15rem 0.45rem;
  border: 1px solid #bee3f8;
  border-radius: 4px;
  color: #2c5282;
  user-select: all;
}

.btn-copy-tracking {
  background: #ffffff;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
}

.btn-copy-tracking:hover {
  background: #ebf8ff;
  border-color: #3182ce;
  color: #2b6cb0;
}

/* Animations for Product Add / Edit / Delete */
.row-pulse-add {
  animation: rowGlowAdd 2.5s ease-out forwards;
}

@keyframes rowGlowAdd {
  0% {
    background-color: rgba(72, 187, 120, 0.4);
    transform: scale(1.02);
  }
  50% {
    background-color: rgba(72, 187, 120, 0.15);
  }
  100% {
    background-color: transparent;
    transform: scale(1);
  }
}

.row-pulse-edit {
  animation: rowGlowEdit 2.5s ease-out forwards;
}

@keyframes rowGlowEdit {
  0% {
    background-color: rgba(212, 175, 55, 0.35);
    transform: scale(1.01);
  }
  50% {
    background-color: rgba(212, 175, 55, 0.12);
  }
  100% {
    background-color: transparent;
    transform: scale(1);
  }
}

.row-fade-out {
  animation: rowDeleteFade 0.6s ease forwards;
}

@keyframes rowDeleteFade {
  0% {
    opacity: 1;
    transform: translateX(0);
    background-color: rgba(229, 62, 62, 0.25);
  }
  100% {
    opacity: 0;
    transform: translateX(-40px);
    height: 0;
    padding: 0;
  }
}

/* ============================================================
   LOCKED PENDING BADGE & ORDER DETAILS ENHANCEMENTS
   ============================================================ */
.status-badge-locked.pending {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fffaf0;
  color: #b7791f;
  border: 1px solid #fbd38d;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.locked-status-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: nowrap;
}

.pay-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  margin-top: 0.35rem;
  padding: 0.22rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 4px;
  background: rgba(26, 18, 8, 0.04);
  border: 1px solid rgba(26, 18, 8, 0.1);
  color: var(--ink-md);
  font-weight: 600;
}

.modal-order-details {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-order-details .modal-header {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  background: transparent !important;
  padding: 0 0 1rem 0 !important;
  margin-bottom: 1.2rem !important;
}

/* Universal non-sticky rule for all modal headers in admin */
.modal-header {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

/* High-contrast, clearly visible cancel button for all modals */
.btn-modal-cancel {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  background: #edf2f7 !important;
  color: #1a202c !important;
  border: 1.5px solid #cbd5e0 !important;
  padding: 0.65rem 1.35rem !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  text-decoration: none !important;
  transition: all 0.18s ease !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.btn-modal-cancel:hover {
  background: #e2e8f0 !important;
  color: #000000 !important;
  border-color: #a0aec0 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08) !important;
}

.order-status-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ============================================================
   ADMIN TOAST NOTIFICATIONS (VIBRANT & LUXURY)
   ============================================================ */
.admin-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.admin-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 1.35rem;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 12px 35px rgba(26, 18, 8, 0.18), 0 3px 10px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  animation: adminToastSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes adminToastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.admin-toast .toast-icon {
  font-size: 1.45rem;
  flex-shrink: 0;
  line-height: 1;
}

.admin-toast .toast-msg {
  flex: 1;
}

.admin-toast .toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #718096;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

.admin-toast .toast-close:hover {
  color: var(--ink);
}

.admin-toast.success {
  background: #f0fdf4 !important;
  border-color: #22c55e !important;
  color: #14532d !important;
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.25) !important;
}

.admin-toast.warning {
  background: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.25) !important;
}

.admin-toast.error {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #7f1d1d !important;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.28) !important;
}

.admin-toast.info {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1e3a8a !important;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.25) !important;
}

/* ==========================================================================
   ORDER DELETE MODAL (Dedicated, No Text Overlap)
   ========================================================================== */
.order-delete-modal-box {
  max-width: 530px !important;
  width: 92% !important;
  background: #ffffff !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22) !important;
  overflow: hidden !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
}

.order-delete-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 1.2rem 1.6rem !important;
  background: #fff5f5 !important;
  border-bottom: 2px solid #fed7d7 !important;
}

.order-delete-modal-title {
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
}

.order-delete-modal-title h3 {
  margin: 0 !important;
  font-size: 1.22rem !important;
  font-family: 'Cormorant Garamond', Georgia, serif !important;
  font-weight: 700 !important;
  color: #c53030 !important;
}

.order-delete-modal-icon {
  font-size: 1.35rem !important;
}

.order-delete-modal-body {
  padding: 1.5rem 1.6rem 1.2rem !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1.1rem !important;
  text-align: left !important;
}

.order-delete-summary {
  margin: 0 !important;
  font-size: 0.98rem !important;
  color: var(--ink) !important;
  line-height: 1.5 !important;
  text-align: left !important;
}

.order-delete-details-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.55rem !important;
  background: #fdfbf7 !important;
  border: 1px solid #e8dec8 !important;
  border-radius: 10px !important;
  padding: 1rem 1.25rem !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.order-delete-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 1rem !important;
  padding: 0.4rem 0 !important;
  border-bottom: 1px dashed rgba(26, 18, 8, 0.12) !important;
  font-size: 0.9rem !important;
}

.order-delete-row:last-child {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.order-delete-row:first-child {
  padding-top: 0 !important;
}

.order-delete-label {
  font-weight: 600 !important;
  color: #555555 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-align: left !important;
}

.order-delete-val {
  font-weight: 600 !important;
  color: #1a1208 !important;
  text-align: right !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
}

.order-delete-bulk-box {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.4rem !important;
  text-align: left !important;
}

.order-delete-bulk-badge {
  font-weight: 700 !important;
  color: #9b2c2c !important;
  font-size: 1.05rem !important;
}

.order-delete-bulk-desc {
  margin: 0 !important;
  font-size: 0.88rem !important;
  color: #666666 !important;
  line-height: 1.45 !important;
}

.order-delete-warning-box {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  background: #fff5f5 !important;
  border: 1.5px solid #feb2b2 !important;
  border-radius: 10px !important;
  padding: 0.85rem 1.1rem !important;
  text-align: left !important;
}

.order-delete-warning-box .warning-icon {
  font-size: 1.2rem !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  margin-top: 0.1rem !important;
}

.order-delete-warning-text {
  font-size: 0.86rem !important;
  color: #9b2c2c !important;
  line-height: 1.45 !important;
}

.order-delete-modal-footer {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 0.85rem !important;
  padding: 1rem 1.6rem 1.4rem !important;
  border-top: 1px solid rgba(26, 18, 8, 0.08) !important;
  background: #faf8f5 !important;
}

/* ============================================================
   PRINT STYLES FOR PACKING SLIP (BOLLA DI SPEDIZIONE)
   ============================================================ */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .admin-header,
  .admin-tabs,
  .admin-action-bar,
  .orders-status-filters,
  .table-card,
  .stats-row,
  .login-card,
  #orderDeleteModalOverlay,
  #safetyModalOverlay,
  #productModalOverlay,
  #deleteModalOverlay,
  #loginScreen,
  #adminToastContainer,
  #storeToastContainer,
  .modal-footer,
  .close-btn {
    display: none !important;
  }

  #orderDetailsModalOverlay {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
  }

  .modal-order-details {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .modal-order-details::before {
    content: "TENUTE ANCONA - BOLLA DI ACCOMPAGNAMENTO E SPEDIZIONE";
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
  }

  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  th, td {
    border-bottom: 1px solid #ccc !important;
    color: #000 !important;
  }
}

@media (max-width: 600px) {
  .pass-grid-cols {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   ADMIN FORM & SHIPPING SETTINGS STYLING (NO OVERLAPPING LABELS)
   ============================================================ */
.admin-field-group,
#shippingSettingsForm .admin-field-group,
#shippingSettingsForm .field-group {
  position: static !important;
  text-align: left;
  margin-bottom: 1.2rem;
}

.admin-field-group label,
#shippingSettingsForm label,
.admin-card label {
  position: static !important;
  transform: none !important;
  display: block !important;
  pointer-events: auto !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: var(--gold) !important;
  margin-bottom: 0.5rem !important;
  opacity: 1 !important;
  line-height: 1.3 !important;
}

#shippingSettingsForm .shipping-input-wrap {
  position: relative !important;
  display: block !important;
  width: 100% !important;
}

#shippingSettingsForm .shipping-input-wrap .currency-prefix {
  position: absolute !important;
  left: 1rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-weight: 700 !important;
  color: #718096 !important;
  pointer-events: none !important;
  font-size: 1.05rem !important;
  z-index: 5 !important;
  line-height: 1 !important;
}

#shippingSettingsForm input[type="number"] {
  width: 100% !important;
  padding: 0.85rem 1rem 0.85rem 2.4rem !important;
  border: 1.5px solid #cbd5e0 !important;
  border-radius: 8px !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  color: #1a202c !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

#shippingSettingsForm input[type="number"]:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(184, 137, 42, 0.18) !important;
  outline: none !important;
}

/* ============================================================
   ADMIN REVIEWS MODERATION STYLING
   ============================================================ */
.admin-reviews-container {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.admin-review-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: all 0.2s ease;
}

.admin-review-card.status-pending {
  border-left: 4px solid #ecc94b;
  background: #fffdf5;
}

.admin-review-card.status-approved {
  border-left: 4px solid #38a169;
}

.admin-review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.admin-review-author-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.admin-review-author-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}

.admin-review-location {
  font-size: 0.85rem;
  color: #718096;
}

.admin-review-rating {
  color: #c5a059;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

.admin-review-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #2d3748;
  margin: 0;
  background: #f8fafc;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  border: 1px solid #edf2f7;
  font-style: italic;
}

.admin-review-product {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.admin-review-product label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a5568;
}

.admin-review-product-select {
  min-width: 220px;
  max-width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
  font-size: 0.85rem;
}

.admin-review-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-top: 0.4rem;
}

.admin-review-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-review-badge.approved {
  background: #def7ec;
  color: #03543f;
}

.admin-review-badge.pending {
  background: #fef08a;
  color: #854d0e;
}

.admin-review-badge.featured {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.admin-review-btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   ENTERPRISE MOBILE RESPONSIVENESS OVERHAUL (SMARTPHONE OPTIMIZATION)
   ============================================================ */
@media (max-width: 900px) {
  .admin-header {
    padding: 0.85rem 1.2rem;
  }
  .admin-content {
    width: 96%;
    padding: 0 0.5rem;
    margin: 1.2rem auto;
  }
  .admin-brand .logo-main {
    font-size: 1.5rem;
  }
}

@media (max-width: 768px) {
  /* 1. Header & Navigation */
  .admin-header {
    padding: 0.75rem 1rem;
    position: static;
  }
  .admin-nav-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }
  .admin-brand {
    justify-content: space-between;
    width: 100%;
  }
  .admin-user-info {
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(26, 18, 8, 0.08);
  }
  .admin-user-info span {
    font-size: 0.85rem;
    font-weight: 700;
  }
  .admin-user-info .btn-sm {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  /* 2. Compact Touch Stats Grid (2-column on mobile) */
  .stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.7rem !important;
    margin-bottom: 1.4rem !important;
  }
  .stat-card {
    padding: 0.9rem 1rem !important;
    border-radius: 10px !important;
  }
  .stat-label {
    font-size: 0.68rem !important;
    margin-bottom: 0.25rem !important;
    letter-spacing: 0.2px !important;
  }
  .stat-value {
    font-size: 1.35rem !important;
  }
  .status-badge {
    font-size: 0.85rem !important;
  }

  /* 3. Horizontal Touch Scroll Segmented Tabs */
  .admin-tabs {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.45rem !important;
    padding: 0.3rem 0 0.6rem !important;
    margin-bottom: 1.3rem !important;
    scrollbar-width: none;
  }
  .admin-tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.82rem !important;
    padding: 0.55rem 0.95rem !important;
    border-radius: 8px !important;
  }

  /* 4. Action bar and search */
  .admin-action-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.7rem !important;
  }
  .search-wrap {
    width: 100% !important;
  }
  .search-wrap input {
    width: 100% !important;
    min-width: unset !important;
    box-sizing: border-box !important;
  }
  .action-btns {
    width: 100% !important;
    display: flex !important;
    gap: 0.5rem !important;
  }
  .action-btns .btn {
    flex: 1 !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    padding: 0.65rem 0.8rem !important;
  }

  /* 5. Responsive Tables & Overflow Prevention */
  .table-card {
    border-radius: 8px !important;
  }
  .table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .admin-table {
    min-width: 600px;
    font-size: 0.82rem !important;
  }
  .admin-table th,
  .admin-table td {
    padding: 0.75rem 0.6rem !important;
  }
  .table-img {
    width: 42px !important;
    height: 42px !important;
  }

  /* 6. Modals on Mobile Viewports */
  .modal-overlay {
    padding: 0.8rem !important;
  }
  .modal,
  .admin-modal,
  .modal-card {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 92vh !important;
    padding: 1.2rem !important;
    margin: auto !important;
    box-sizing: border-box !important;
    border-radius: 14px !important;
  }
  .modal-header h3 {
    font-size: 1.3rem !important;
  }
  .field-grid,
  .modal form [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 0.8rem !important;
  }
  .modal-footer {
    flex-direction: column-reverse !important;
    gap: 0.6rem !important;
  }
  .modal-footer button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* 7. Login Screen */
  .login-card {
    width: 94vw !important;
    max-width: 94vw !important;
    padding: 1.8rem 1.4rem !important;
    border-radius: 14px !important;
  }
  .login-card .logo-main {
    font-size: 1.8rem !important;
  }

  /* 8. Review Cards on Mobile */
  .admin-review-card {
    padding: 1.1rem 1.2rem !important;
  }
  .admin-review-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .admin-review-card-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .admin-review-btn-group {
    width: 100%;
    display: flex;
  }
  .admin-review-btn-group button {
    flex: 1;
    font-size: 0.78rem;
    padding: 0.45rem 0.6rem;
    text-align: center;
  }
}

/* ===== DISCOUNT CODES TAB (codici sconto, issue 06) ===== */

.discount-code-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1rem;
  letter-spacing: 0.06em;
  /* A code is 8 characters in two groups: never break it at the hyphen */
  white-space: nowrap;
}

.discount-note-cell {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.discount-empty {
  text-align: center;
  padding: 2.5rem;
  color: #718096;
}

.discount-empty-error {
  color: #c53030;
}

/* Status badges, coherent with the order statuses (new = neutral, in use = green, used up = grey, expired = orange, disabled = red) */
.discount-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  background: #edf2f7;
  color: #2d3748;
  border: 1px solid #cbd5e0;
}

.discount-badge-new {
  background: var(--cream-dk);
  color: var(--ink);
  border-color: var(--gold-pale);
}

.discount-badge-in_use {
  background: #e6f4ea;
  color: #137333;
  border-color: #b7dfc2;
}

.discount-badge-exhausted {
  background: #e2e8f0;
  color: #4a5568;
  border-color: #cbd5e0;
}

.discount-badge-expired {
  background: #fff4e0;
  color: #b06000;
  border-color: #f2d19b;
}

.discount-badge-disabled {
  background: #fce8e6;
  color: #c5221f;
  border-color: #f4b8b4;
}

/* Row actions */
.discount-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.discount-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid rgba(26, 18, 8, 0.18);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.discount-action:hover {
  background: rgba(184, 137, 42, 0.1);
  border-color: var(--gold);
}

.discount-action:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.discount-action-whatsapp {
  color: #137333;
  border-color: #b7dfc2;
  background: #f1faf4;
}

.discount-action-danger {
  color: #c53030;
  border-color: #f4b8b4;
}

/* Detail of the uses (row under the code) */
.discount-detail-row > td {
  background: var(--cream);
  padding: 1rem 1.2rem;
}

.discount-use-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.discount-use {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.8rem;
  padding: 0.55rem 0.8rem;
  background: #ffffff;
  border: 1px solid rgba(26, 18, 8, 0.1);
  border-left-width: 4px;
  border-radius: 6px;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.discount-use-title {
  font-weight: 700;
}

.discount-use-value {
  font-weight: 700;
  color: var(--olive-dk);
}

.discount-use-detail {
  color: #4a5568;
}

.discount-use-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #edf2f7;
  color: #2d3748;
}

.discount-use.is-taken {
  border-left-color: #137333;
}

.discount-use.is-taken .discount-use-tag {
  background: #e6f4ea;
  color: #137333;
}

.discount-use.is-free {
  border-left-color: #cbd5e0;
}

.discount-use.is-released {
  border-left-color: #b06000;
  background: #fffaf0;
}

.discount-use.is-released .discount-use-tag {
  background: #fff4e0;
  color: #b06000;
}

.discount-use.is-overflow {
  border-left-color: #c5221f;
  background: #fff5f5;
}

.discount-use.is-overflow .discount-use-tag {
  background: #fce8e6;
  color: #c5221f;
}

/* Generation modal */
.discount-steps {
  margin-bottom: 1.2rem;
}

.discount-step-row {
  margin-bottom: 0.8rem;
}

.discount-step-title {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

.discount-step-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(90px, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.discount-step-unit {
  font-weight: 700;
  color: var(--ink-md);
  min-width: 1.2rem;
}

.discount-code-field {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.discount-code-field input {
  flex: 1;
  min-width: 0;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-modal input[type="date"] {
  width: 100%;
  background: var(--cream);
  border: 1px solid rgba(26, 18, 8, 0.18);
  color: var(--ink);
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.discount-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: #718096;
  line-height: 1.4;
}

.discount-warning {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #92400e;
}

.discount-warning:empty {
  display: none;
}

/* The title only receives the focus from the script (after a deletion), no ring needed */
#discountsTitle:focus {
  outline: none;
}

/* "Rigenera": same thin border and weight as its sibling buttons, so it reads as a button */
.discount-regenerate {
  border: 1px solid rgba(26, 18, 8, 0.2);
  font-weight: 600;
  padding: 0.6rem 1rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .discount-action {
    min-height: 44px;
  }

  #discountStatusFilters .status-filter-btn {
    min-height: 44px;
  }

  .discount-step-controls {
    grid-template-columns: 1fr 1fr auto;
  }

  .discount-code-field {
    flex-direction: column;
  }

  .discount-actions {
    min-width: 200px;
  }

  /* The list scrolls sideways inside its card: keep the uses of a code in view instead of cutting them at the edge */
  .discount-detail {
    position: sticky;
    left: 0;
    width: calc(100vw - 4.5rem);
    max-width: 100%;
  }
}
/* ===== END DISCOUNT CODES TAB ===== */
