.admin-body {
  margin: 0;
  min-height: 100vh;
  background: #f4f7fb;
  color: #0f172a;
  font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
}

/* Abandoned cart recovery */
.abandoned-stats {
  margin-bottom: 1rem;
}

.abandoned-filters {
  align-items: end;
}

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

.abandoned-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.abandoned-card--contacted {
  border-color: #f5c26b;
}

.abandoned-card--recovered {
  border-color: #86d3ae;
  background: #fbfffd;
}

.abandoned-card--dismissed {
  opacity: 0.78;
}

.abandoned-card__head,
.abandoned-card__meta,
.abandoned-card__total,
.abandoned-card__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.abandoned-card__head {
  align-items: flex-start;
}

.abandoned-card__head h2 {
  margin: 0 0 0.2rem;
  color: #0f172a;
  font-size: 1rem;
}

.abandoned-card__head a {
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
}

.abandoned-card__meta {
  color: #64748b;
  font-size: 0.78rem;
}

.abandoned-card__live {
  padding: 0.65rem 0.75rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.abandoned-card__items {
  display: grid;
  gap: 0.55rem;
}

.abandoned-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem;
  background: #f8fafc;
  border-radius: 11px;
}

.abandoned-item img {
  width: 52px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.abandoned-item strong,
.abandoned-item small,
.abandoned-item span {
  display: block;
}

.abandoned-item strong {
  color: #1e293b;
  font-size: 0.8rem;
  line-height: 1.45;
}

.abandoned-item small,
.abandoned-item span {
  margin-top: 0.15rem;
  color: #64748b;
  font-size: 0.72rem;
}

.abandoned-card__total {
  padding-top: 0.75rem;
  border-top: 1px dashed #cbd5e1;
}

.abandoned-card__total span {
  color: #64748b;
  font-size: 0.8rem;
}

.abandoned-card__total strong {
  color: #0f172a;
  font-size: 1.05rem;
}

.abandoned-card__actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.abandoned-card__actions form {
  margin: 0;
}

.admin-btn--whatsapp {
  color: #fff;
  background: #128c7e;
  border-color: #128c7e;
}

.admin-btn--whatsapp:hover,
.admin-btn--whatsapp:focus-visible {
  color: #fff;
  background: #0f7469;
  border-color: #0f7469;
}

.admin-btn--whatsapp:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 900px) {
  .abandoned-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .abandoned-card__head,
  .abandoned-card__meta,
  .abandoned-card__total {
    align-items: flex-start;
    flex-direction: column;
  }

  .abandoned-card__actions,
  .abandoned-card__actions form,
  .abandoned-card__actions .admin-btn {
    width: 100%;
  }
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  width: 260px;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
  box-sizing: border-box;
  background: linear-gradient(180deg, #0b3d5c 0%, #062a42 100%);
  color: #e2f4ff;
  padding: 1rem 0 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
}

.admin-sidebar__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #14b8a6;
  color: #042f2e;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.admin-sidebar__title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.admin-sidebar__subtitle {
  display: block;
  margin-top: 0.15rem;
  color: #8cc9dc;
  font-size: 0.72rem;
  font-weight: 600;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0.6rem;
}

.admin-nav__section {
  margin: 0;
  padding: 0.35rem 0 0.55rem;
}

.admin-nav__section + .admin-nav__section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-nav__section-title {
  margin: 0;
  padding: 0.55rem 0.75rem 0.35rem;
  color: #77b7cb;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.admin-nav__link {
  display: block;
  margin: 0.12rem 0;
  padding: 0.52rem 0.75rem;
  border-inline-start: 3px solid transparent;
  border-radius: 8px;
  color: #c8e8f5;
  text-decoration: none;
  font-size: 0.84rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-nav__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-nav__link.is-active {
  background: rgba(20, 184, 166, 0.25);
  border-inline-start-color: #5eead4;
  color: #5eead4;
  font-weight: 750;
}

.admin-nav__footer {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-nav__link--external::after {
  content: "↗";
  margin-inline-start: 0.4rem;
  color: #77b7cb;
  font-size: 0.75rem;
}

.admin-nav__link--muted {
  color: #94a3b8;
  font-size: 0.85rem;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-main__head {
  padding: 1.25rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.admin-main__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.admin-main__content {
  padding: 1.5rem;
  flex: 1;
}

.admin-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-stat {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 1rem 1.15rem;
}

.admin-stat__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0b3d5c;
  line-height: 1.2;
}

.admin-stat__label {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.admin-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.admin-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.admin-alert--ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid #e2e8f0;
}

.admin-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

.admin-table tr:hover td {
  background: #fafbfc;
}

.admin-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-badge--on {
  background: #d1fae5;
  color: #047857;
}

.admin-badge--off {
  background: #f1f5f9;
  color: #64748b;
}

.admin-stock {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.admin-stock--ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.admin-stock--low {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.admin-stock--out {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.admin-table--reviews {
  table-layout: fixed;
}

.admin-table--reviews th,
.admin-table--reviews td {
  vertical-align: top;
}

.admin-table--reviews th:nth-child(1),
.admin-table--reviews td:nth-child(1) {
  width: 15%;
}

.admin-table--reviews th:nth-child(2),
.admin-table--reviews td:nth-child(2) {
  width: 10%;
}

.admin-table--reviews th:nth-child(3),
.admin-table--reviews td:nth-child(3) {
  width: 6%;
}

.admin-table--reviews th:nth-child(4),
.admin-table--reviews td:nth-child(4) {
  width: 34%;
}

.admin-table--reviews th:nth-child(5),
.admin-table--reviews td:nth-child(5) {
  width: 10%;
}

.admin-table--reviews th:nth-child(6),
.admin-table--reviews td:nth-child(6) {
  width: 9%;
}

.admin-table--reviews th:nth-child(7),
.admin-table--reviews td:nth-child(7) {
  width: 16%;
}

.admin-review-comment {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 7.5rem;
  overflow-y: auto;
}

.admin-review-comment--empty {
  padding: 0;
  color: #94a3b8;
  background: transparent;
  border: none;
}

@media (max-width: 900px) {
  .admin-table--reviews {
    table-layout: auto;
    min-width: 52rem;
  }

  .admin-review-comment {
    min-width: 14rem;
    max-height: 10rem;
  }
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.admin-btn--primary {
  background: #0b3d5c;
  color: #fff;
}

.admin-btn--primary:hover {
  background: #094a6e;
}

.admin-btn--ghost {
  background: #f1f5f9;
  color: #334155;
}

.admin-btn--ghost:hover {
  background: #e2e8f0;
}

.admin-btn--danger {
  background: #fef2f2;
  color: #b91c1c;
}

.admin-btn--danger:hover {
  background: #fee2e2;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.admin-form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .admin-form-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
}

.admin-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(1rem + 6px) calc(50% - 2px),
    calc(1rem) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-left: 2.25rem;
  cursor: pointer;
}

.admin-field textarea {
  min-height: 88px;
  resize: vertical;
}

.admin-textarea--tall {
  min-height: 180px;
}

.admin-textarea--xl {
  min-height: 320px;
  line-height: 1.55;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  border-color: #0b3d5c;
  box-shadow: 0 0 0 3px rgba(11, 61, 92, 0.12);
  outline: none;
}

.admin-field small {
  display: block;
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.75rem;
}

.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(145deg, #0b3d5c 0%, #042f2e 50%, #0f172a 100%);
}

.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.admin-login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  color: #0b3d5c;
}

.admin-login-card p {
  margin: 0 0 1.25rem;
  color: #64748b;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    overflow-y: visible;
    padding: 0.6rem 0 0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 0 0.75rem 0.25rem;
    gap: 0.45rem;
  }

  .admin-nav__section,
  .admin-nav__footer {
    display: contents;
  }

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

  .admin-nav__link {
    flex: 0 0 auto;
    text-align: center;
    min-width: max-content;
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.52rem 0.72rem;
    margin: 0;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.14);
  }

  .admin-nav__link--muted {
    margin-top: 0;
  }

  .admin-main__head {
    padding: 0.9rem 1rem;
  }

  .admin-main__title {
    font-size: 1.05rem;
  }

  .admin-main__content {
    padding: 1rem;
  }

  .admin-card {
    padding: 0.9rem;
    border-radius: 10px;
  }

  .admin-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .admin-sidebar__brand {
    padding: 0 0.8rem 0.7rem;
    margin-bottom: 0.55rem;
  }

  .admin-sidebar__logo {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .admin-sidebar__title {
    font-size: 0.85rem;
  }

  .admin-main__content {
    padding: 0.75rem;
  }

  .admin-card {
    padding: 0.75rem;
  }
}

/* ============================================
   Order status select & badge
   ============================================ */
.admin-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}

.admin-status--pending {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.admin-status--confirmed {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.admin-status--processing {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.admin-status--ready {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.admin-status--shipped {
  background: #cffafe;
  color: #155e75;
  border-color: #a5f3fc;
}

.admin-status--delivered {
  background: #d1fae5;
  color: #047857;
  border-color: #a7f3d0;
}

.admin-status--cancelled {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.admin-status-form {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-status-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.3rem 1.5rem 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23475569' d='M5 6 0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.55rem center;
  background-size: 9px 6px;
  transition: filter 0.15s ease, transform 0.15s ease;
}

[dir="rtl"] .admin-status-select {
  padding: 0.3rem 0.6rem 0.3rem 1.5rem;
  background-position: left 0.55rem center;
}

.admin-status-select:hover {
  filter: brightness(0.97);
}

.admin-status-select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ============================================
   Admin note (per-row textarea + button)
   ============================================ */
.admin-note-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 220px;
}

.admin-note-input {
  width: 100%;
  min-width: 200px;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-note-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.admin-note-save {
  align-self: flex-end;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

/* ============================================
   Orders dashboard and reporting
   ============================================ */
.admin-order-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #cbd5e1;
}

.admin-order-tab {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 1rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 3px solid transparent;
}

.admin-order-tab:hover {
  color: #0b3d5c;
}

.admin-order-tab.is-active {
  color: #0b3d5c;
  border-bottom-color: #14b8a6;
}

.admin-section-head,
.admin-prep-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-section-head h2,
.admin-prep-title h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #0b3d5c;
}

.admin-section-head p,
.admin-prep-title p {
  margin: 0.3rem 0 0;
  color: #64748b;
  font-size: 0.86rem;
}

.admin-report-filter {
  border-inline-start: 4px solid #14b8a6;
}

.admin-report-filter__form {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(150px, 220px) auto;
  align-items: end;
  gap: 0.75rem;
}

.admin-period-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.admin-period-shortcuts a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #475569;
  background: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-period-shortcuts a:hover,
.admin-period-shortcuts a.is-active {
  color: #fff;
  background: #0b3d5c;
  border-color: #0b3d5c;
}

.admin-order-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-kpi {
  display: block;
  min-width: 0;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-kpi--link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.admin-kpi--link:hover {
  border-color: #14b8a6;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.admin-kpi--attention {
  border-color: #fbbf24;
  background: linear-gradient(145deg, #fff 0%, #fffbeb 100%);
}

.admin-kpi__label {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-kpi__value {
  margin-top: 0.35rem;
  color: #0b3d5c;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 850;
}

.admin-kpi__value--money {
  font-size: 1.35rem;
  line-height: 1.35;
}

.admin-kpi__meta {
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.76rem;
}

.admin-kpi__link {
  display: inline-flex;
  margin-top: 0.7rem;
  color: #0b3d5c;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.65rem;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
}

.admin-trend--up {
  color: #047857;
  background: #ecfdf5;
}

.admin-trend--down {
  color: #b91c1c;
  background: #fef2f2;
}

.admin-trend--flat {
  color: #475569;
  background: #f1f5f9;
}

.admin-order-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  min-height: 230px;
  padding: 2rem 0.75rem 0.25rem;
  overflow-x: auto;
  border-bottom: 1px solid #cbd5e1;
}

.admin-order-chart__bucket {
  position: relative;
  display: flex;
  flex: 1 0 42px;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-width: 42px;
  height: 180px;
}

.admin-order-chart__value {
  margin-bottom: 0.25rem;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
}

.admin-order-chart__bar {
  display: block;
  width: min(30px, 70%);
  min-height: 4px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #14b8a6 0%, #0b3d5c 100%);
}

.admin-order-chart__label {
  position: absolute;
  top: calc(100% + 0.4rem);
  color: #64748b;
  font-size: 0.65rem;
  white-space: nowrap;
}

.admin-order-pipeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.admin-pipeline-card {
  display: flex;
  min-width: 100px;
  padding: 0.75rem;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid #e2e8f0;
  border-top: 3px solid #94a3b8;
  border-radius: 10px;
  color: #475569;
  background: #fff;
  text-decoration: none;
}

.admin-pipeline-card span {
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-pipeline-card strong {
  color: #0f172a;
  font-size: 1.35rem;
}

.admin-pipeline-card--pending { border-top-color: #f59e0b; }
.admin-pipeline-card--confirmed { border-top-color: #3b82f6; }
.admin-pipeline-card--processing { border-top-color: #8b5cf6; }
.admin-pipeline-card--ready { border-top-color: #22c55e; }
.admin-pipeline-card--shipped { border-top-color: #06b6d4; }
.admin-pipeline-card--delivered { border-top-color: #10b981; }
.admin-pipeline-card--cancelled { border-top-color: #ef4444; }

.admin-order-search {
  display: grid;
  grid-template-columns: minmax(250px, 2fr) minmax(150px, 1fr) auto auto;
  align-items: end;
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.admin-order-search--prep {
  grid-template-columns: minmax(130px, 0.8fr) minmax(135px, 0.8fr) minmax(135px, 0.8fr) minmax(150px, 0.9fr) minmax(220px, 1.5fr) auto;
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.admin-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.82rem;
}

.admin-bulk-bar select {
  min-width: 165px;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}

.admin-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
}

.admin-orders-table td {
  vertical-align: top;
}

.admin-check-cell {
  width: 32px;
  text-align: center !important;
}

.admin-order-number {
  color: #0b3d5c;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 850;
  white-space: nowrap;
}

.admin-order-number:hover {
  text-decoration: underline;
}

.admin-cell-muted {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.72rem;
}

.admin-cell-phone {
  display: block;
  width: fit-content;
  margin-top: 0.2rem;
  color: #0f766e;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-items-cell {
  min-width: 210px;
  line-height: 1.55;
}

.admin-order-total {
  color: #0b3d5c;
  font-weight: 850;
  white-space: nowrap;
}

.admin-btn--compact {
  width: auto;
  padding: 0.32rem 0.6rem;
  font-size: 0.78rem;
}

.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-pagination a,
.admin-pagination span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #475569;
  background: #fff;
  text-decoration: none;
  font-size: 0.8rem;
}

.admin-pagination a:hover {
  color: #fff;
  background: #0b3d5c;
  border-color: #0b3d5c;
}

.admin-empty {
  margin: 0;
  padding: 1rem;
  color: #64748b;
  text-align: center;
}

.admin-dashboard-orders {
  margin-bottom: 1.5rem;
}

.admin-dashboard-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.35rem 1.5rem;
  overflow: hidden;
  border-radius: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(94, 234, 212, 0.2), transparent 34%),
    linear-gradient(135deg, #0b3d5c 0%, #075985 100%);
  box-shadow: 0 12px 28px rgba(11, 61, 92, 0.16);
}

.admin-dashboard-welcome__eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: #99f6e4;
  font-size: 0.75rem;
  font-weight: 800;
}

.admin-dashboard-welcome h2 {
  margin: 0;
  font-size: 1.25rem;
}

.admin-dashboard-welcome p {
  margin: 0.4rem 0 0;
  color: #d9f3fb;
  font-size: 0.88rem;
}

.admin-dashboard-welcome .admin-btn--ghost {
  flex: 0 0 auto;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.admin-dashboard-welcome .admin-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.admin-dashboard-section {
  margin-bottom: 1.5rem;
}

.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-action-card {
  display: flex;
  min-height: 175px;
  padding: 1.1rem 1.2rem;
  box-sizing: border-box;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #94a3b8;
  border-radius: 12px;
  color: #0f172a;
  background: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.admin-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
}

.admin-action-card--attention {
  border-top-color: #f59e0b;
  background: linear-gradient(145deg, #fff 0%, #fffbeb 100%);
}

.admin-action-card--ready {
  border-top-color: #10b981;
  background: linear-gradient(145deg, #fff 0%, #ecfdf5 100%);
}

.admin-action-card--danger {
  border-top-color: #ef4444;
  background: linear-gradient(145deg, #fff 0%, #fef2f2 100%);
}

.admin-action-card--clear {
  border-top-color: #14b8a6;
}

.admin-action-card__label {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-action-card strong {
  margin-top: 0.25rem;
  color: #0b3d5c;
  font-size: 2rem;
  line-height: 1.15;
}

.admin-action-card p {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.55;
}

.admin-action-card__link {
  margin-top: auto;
  padding-top: 0.8rem;
  color: #0b3d5c;
  font-size: 0.78rem;
  font-weight: 850;
}

.admin-order-kpis--dashboard {
  margin-bottom: 0;
}

.admin-stock-alert {
  border-inline-start: 4px solid #f59e0b;
}

.admin-stock-alert .admin-section-head h2 {
  color: #b45309;
}

.admin-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.admin-quick-card {
  display: flex;
  min-width: 0;
  min-height: 105px;
  padding: 1rem;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #dbe5ec;
  border-radius: 11px;
  color: #0f172a;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.admin-quick-card:hover {
  border-color: #14b8a6;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
}

.admin-quick-card strong {
  color: #0b3d5c;
  font-size: 0.92rem;
}

.admin-quick-card span {
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.5;
}

.admin-stats--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.admin-stats--compact .admin-stat {
  min-width: 0;
}

.admin-stat__value small {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ============================================
   Order preparation board
   ============================================ */
.admin-prep-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.admin-prep-stat {
  display: flex;
  min-height: 105px;
  padding: 0.9rem 1rem;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-inline-start: 4px solid #94a3b8;
  border-radius: 10px;
  background: #fff;
}

.admin-prep-stat > span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-prep-stat > strong {
  margin-top: 0.25rem;
  color: #0b3d5c;
  font-size: 1.8rem;
}

.admin-prep-stat > small {
  margin-top: auto;
  color: #64748b;
}

.admin-prep-stat a {
  color: inherit;
  font-weight: 700;
}

.admin-prep-stat--attention { border-inline-start-color: #f59e0b; }
.admin-prep-stat--ready { border-inline-start-color: #22c55e; }
.admin-prep-stat--late {
  border-inline-start-color: #ef4444;
  background: #fffafa;
}

.admin-prep-products {
  border-top: 4px solid #14b8a6;
}

.admin-qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 34px;
  padding: 0 0.6rem;
  border-radius: 9px;
  color: #fff;
  background: #0b3d5c;
  font-size: 1rem;
  font-weight: 850;
}

.admin-prep-orders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-prep-order {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.05);
}

.admin-prep-order.is-late {
  border-color: #fca5a5;
  box-shadow: inset 4px 0 0 #ef4444, 0 2px 5px rgba(15, 23, 42, 0.05);
}

.admin-prep-order__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.admin-prep-order__head > .admin-status {
  margin-inline-start: auto;
}

.admin-prep-order__check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}

.admin-late-badge {
  display: inline-flex;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: #b91c1c;
  background: #fee2e2;
  font-size: 0.7rem;
  font-weight: 850;
}

.admin-prep-order__body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.admin-prep-customer,
.admin-prep-items {
  padding: 0.9rem;
}

.admin-prep-customer {
  border-inline-end: 1px solid #e2e8f0;
}

.admin-prep-customer h3,
.admin-prep-items h3 {
  margin: 0;
  color: #0f172a;
  font-size: 0.92rem;
}

.admin-prep-customer > a {
  display: inline-flex;
  margin-top: 0.35rem;
  color: #0f766e;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-prep-customer p {
  margin: 0.35rem 0 0;
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.5;
}

.admin-prep-note {
  margin-top: 0.65rem;
  padding: 0.55rem;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #92400e;
  background: #fffbeb;
  font-size: 0.75rem;
  line-height: 1.5;
}

.admin-prep-items__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.admin-prep-items__title span {
  color: #0b3d5c;
  font-size: 0.74rem;
  font-weight: 800;
}

.admin-prep-items ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.admin-prep-items li {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.45rem 0.55rem;
  border-radius: 7px;
  color: #334155;
  background: #f8fafc;
  font-size: 0.78rem;
}

.admin-prep-items li strong {
  flex: 0 0 auto;
  color: #0b3d5c;
  font-size: 0.9rem;
}

.admin-prep-order__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid #e2e8f0;
}

.admin-prep-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
}

@media (max-width: 1180px) {
  .admin-order-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .admin-order-pipeline {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }

  .admin-order-search--prep {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 900px) {
  .admin-report-filter__form,
  .admin-order-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-order-search__query {
    grid-column: 1 / -1;
  }

  .admin-prep-orders {
    grid-template-columns: 1fr;
  }

  .admin-prep-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .admin-section-head,
  .admin-prep-title {
    flex-direction: column;
  }

  .admin-order-kpis,
  .admin-prep-overview,
  .admin-report-filter__form,
  .admin-order-search,
  .admin-order-search--prep,
  .admin-quick-grid,
  .admin-stats--compact {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-welcome {
    align-items: flex-start;
    padding: 1.1rem;
    flex-direction: column;
  }

  .admin-dashboard-welcome .admin-btn {
    width: 100%;
  }

  .admin-report-filter__form .admin-btn,
  .admin-order-search .admin-btn {
    width: 100%;
  }

  .admin-prep-order__body {
    grid-template-columns: 1fr;
  }

  .admin-prep-customer {
    border-inline-end: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .admin-prep-order__head,
  .admin-prep-order__footer {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .admin-prep-order__head > .admin-status {
    margin-inline-start: 0;
  }

  .admin-prep-actions {
    width: 100%;
  }

  .admin-prep-actions form,
  .admin-prep-actions .admin-btn {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media print {
  .admin-sidebar,
  .admin-main__head,
  .admin-no-print,
  .admin-alert {
    display: none !important;
  }

  .admin-body,
  .admin-main,
  .admin-main__content {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }

  .admin-prep-title {
    margin-bottom: 10px;
  }

  .admin-prep-overview {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }

  .admin-prep-stat {
    min-height: auto;
    padding: 6px;
    break-inside: avoid;
  }

  .admin-card {
    padding: 8px;
    margin-bottom: 10px;
    box-shadow: none;
  }

  .admin-prep-orders {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .admin-prep-order {
    break-inside: avoid;
    box-shadow: none;
  }

  .admin-prep-order__head,
  .admin-prep-order__footer,
  .admin-prep-customer,
  .admin-prep-items {
    padding: 6px 8px;
  }

  .admin-prep-order__body {
    grid-template-columns: 0.8fr 1.2fr;
  }
}

/* Keep the previously delivered English order screens correctly LTR. */
.admin-orders-ui {
  direction: ltr;
  text-align: left;
}

.admin-orders-ui .admin-table th,
.admin-orders-ui .admin-table td {
  text-align: left;
}

.admin-orders-ui .admin-check-cell {
  text-align: center !important;
}

.admin-orders-ui input,
.admin-orders-ui select,
.admin-orders-ui button {
  direction: ltr;
  text-align: left;
}

.admin-orders-ui .admin-btn {
  text-align: center;
}

/* ============================================
   Comprehensive analytics
   ============================================ */
.admin-analytics {
  --analytics-ink: #0b3d5c;
  --analytics-teal: #0f9f91;
  --analytics-blue: #2563eb;
  --analytics-muted: #64748b;
  color: #0f172a;
}

.admin-analytics [id] {
  scroll-margin-top: 1.25rem;
}

[dir="ltr"] .admin-analytics .admin-table th,
[dir="ltr"] .admin-analytics .admin-table td {
  text-align: left;
}

[dir="ltr"] .admin-analytics .analytics-chart__axis,
[dir="ltr"] .admin-analytics .analytics-chart__label,
[dir="ltr"] .admin-analytics .analytics-chart__orders-axis {
  direction: ltr;
}

.analytics-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1.4rem 1.5rem;
  overflow: hidden;
  border-radius: 16px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 15%, rgba(94, 234, 212, 0.24), transparent 32%),
    linear-gradient(135deg, #073b59 0%, #075985 58%, #0f766e 100%);
  box-shadow: 0 14px 30px rgba(11, 61, 92, 0.17);
}

.analytics-hero__eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: #99f6e4;
  font-size: 0.75rem;
  font-weight: 850;
}

.analytics-hero h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.analytics-hero p {
  margin: 0.45rem 0 0;
  color: #d9f3fb;
  font-size: 0.86rem;
  line-height: 1.65;
}

.analytics-hero__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.analytics-language-switch {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.analytics-language-switch > span {
  padding-inline: 0.55rem 0.3rem;
  color: #d9f3fb;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.analytics-language-switch a {
  display: inline-flex;
  min-height: 30px;
  padding: 0 0.62rem;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #ecfeff;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 850;
}

.analytics-language-switch a:hover,
.analytics-language-switch a.is-active {
  color: #064e3b;
  background: #fff;
}

.analytics-language-switch a.is-active {
  pointer-events: none;
}

.analytics-hero .admin-btn--ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.analytics-hero .admin-btn--primary {
  color: #064e3b;
  background: #99f6e4;
}

.analytics-filter {
  border-inline-start: 4px solid var(--analytics-teal);
}

.analytics-period-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.analytics-period-shortcuts a,
.analytics-section-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #475569;
  background: #fff;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.analytics-period-shortcuts a:hover,
.analytics-period-shortcuts a.is-active,
.analytics-section-nav a:hover {
  color: #fff;
  background: var(--analytics-ink);
  border-color: var(--analytics-ink);
}

.analytics-custom-period {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(160px, 220px) auto;
  align-items: end;
  gap: 0.75rem;
}

.analytics-section-nav {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  padding: 0.55rem;
  overflow-x: auto;
  border: 1px solid #dbe5ec;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
}

.analytics-section {
  margin-bottom: 1.75rem;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.analytics-kpi {
  display: flex;
  min-width: 0;
  min-height: 142px;
  padding: 1rem;
  box-sizing: border-box;
  flex-direction: column;
  border: 1px solid #dfe7ee;
  border-top: 3px solid #8bd9d0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

.analytics-kpi__label {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
}

.analytics-kpi strong {
  margin-top: 0.3rem;
  overflow-wrap: anywhere;
  color: var(--analytics-ink);
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  line-height: 1.25;
}

.analytics-kpi__meta {
  margin-top: 0.3rem;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.5;
}

.analytics-kpi .admin-trend {
  margin-top: auto;
  padding-top: 0.55rem;
}

.analytics-chart-card {
  overflow: hidden;
}

.analytics-chart-legend {
  display: flex;
  gap: 0.45rem;
}

.analytics-chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  color: #64748b;
  background: #fff;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  opacity: 0.58;
}

.analytics-chart-legend button.is-active {
  color: #0f172a;
  border-color: #94a3b8;
  opacity: 1;
}

.analytics-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.analytics-dot--revenue {
  background: #14b8a6;
}

.analytics-dot--orders {
  background: #2563eb;
}

.analytics-chart-scroll {
  width: 100%;
  overflow-x: auto;
}

.analytics-chart {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
  min-height: 280px;
}

.analytics-chart__grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.analytics-chart__axis,
.analytics-chart__label,
.analytics-chart__orders-axis {
  fill: #64748b;
  font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
  font-size: 11px;
}

.analytics-chart__bar {
  fill: #5eead4;
  opacity: 0.82;
  transition: opacity 0.15s;
}

.analytics-chart__bar:hover {
  fill: #14b8a6;
  opacity: 1;
}

.analytics-chart__bar.is-hidden {
  opacity: 0;
}

.analytics-chart__bucket {
  cursor: pointer;
  outline: none;
}

.analytics-chart__bucket:focus .analytics-chart__bar {
  fill: #0f766e;
  opacity: 1;
}

.analytics-chart__line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.analytics-chart__point {
  fill: #fff;
  stroke: #2563eb;
  stroke-width: 3;
}

.analytics-chart-detail {
  margin-top: 0.5rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #1e3a8a;
  background: #eff6ff;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.analytics-rate-grid,
.analytics-mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.analytics-rate-card,
.analytics-mini-kpis article {
  display: flex;
  min-width: 0;
  min-height: 112px;
  padding: 0.95rem 1rem;
  box-sizing: border-box;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #dfe7ee;
  border-radius: 12px;
  background: #fff;
}

.analytics-rate-card {
  border-inline-start: 4px solid #94a3b8;
}

.analytics-rate-card--success {
  border-inline-start-color: #10b981;
  background: linear-gradient(135deg, #fff, #ecfdf5);
}

.analytics-rate-card--danger {
  border-inline-start-color: #ef4444;
  background: linear-gradient(135deg, #fff, #fef2f2);
}

.analytics-rate-card span,
.analytics-mini-kpis span {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
}

.analytics-rate-card strong,
.analytics-mini-kpis strong {
  margin-top: 0.25rem;
  color: var(--analytics-ink);
  font-size: 1.45rem;
}

.analytics-rate-card small {
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.72rem;
}

.analytics-mini-kpis {
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
}

.analytics-mini-kpis article {
  min-height: 95px;
}

.analytics-mini-kpis strong {
  font-size: 1.15rem;
}

.analytics-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.analytics-status {
  padding: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
}

.analytics-status > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.analytics-status span {
  color: #475569;
  font-size: 0.76rem;
  font-weight: 750;
}

.analytics-status strong {
  color: var(--analytics-ink);
  font-size: 1.2rem;
}

.analytics-status__track {
  display: block;
  height: 6px;
  margin: 0.65rem 0 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}

.analytics-status__track span {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: #94a3b8;
}

.analytics-status--pending .analytics-status__track span {
  background: #f59e0b;
}

.analytics-status--confirmed .analytics-status__track span,
.analytics-status--shipped .analytics-status__track span {
  background: #3b82f6;
}

.analytics-status--processing .analytics-status__track span {
  background: #8b5cf6;
}

.analytics-status--ready .analytics-status__track span,
.analytics-status--delivered .analytics-status__track span {
  background: #10b981;
}

.analytics-status--cancelled .analytics-status__track span,
.analytics-status--returned .analytics-status__track span {
  background: #ef4444;
}

.analytics-status small {
  color: #94a3b8;
  font-size: 0.68rem;
}

.analytics-note {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  color: #475569;
  background: #f8fafc;
  font-size: 0.76rem;
  line-height: 1.6;
}

.analytics-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.analytics-ranking {
  margin-bottom: 0;
}

.analytics-ranking h3 {
  margin: 0 0 0.75rem;
  color: var(--analytics-ink);
  font-size: 0.92rem;
}

.analytics-ranking ol {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: analytics-rank;
}

.analytics-ranking li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #edf2f7;
  counter-increment: analytics-rank;
}

.analytics-ranking li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.analytics-ranking li::before {
  content: counter(analytics-rank);
  display: flex;
  width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #0f766e;
  background: #ccfbf1;
  font-size: 0.72rem;
  font-weight: 900;
}

.analytics-ranking li span {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-ranking li strong {
  color: var(--analytics-ink);
  font-size: 0.76rem;
  white-space: nowrap;
}

.analytics-low-stock {
  margin-top: 1rem;
  border: 1px solid #fde68a;
  color: #92400e;
  background: #fffbeb;
}

.analytics-low-stock a {
  color: #92400e;
  font-weight: 800;
}

.analytics-table {
  min-width: 820px;
}

.analytics-table th {
  white-space: nowrap;
}

.analytics-table th button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.analytics-table th button::after {
  content: "↕";
  margin-inline-start: 0.25rem;
  color: #94a3b8;
  font-size: 0.65rem;
}

.analytics-table td {
  vertical-align: middle;
}

.analytics-product {
  display: flex;
  align-items: center;
  min-width: 260px;
  gap: 0.7rem;
}

.analytics-product img {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  object-fit: contain;
}

.analytics-product strong {
  display: block;
  max-width: 360px;
  color: #334155;
  font-size: 0.78rem;
  line-height: 1.5;
}

.analytics-product > div > span {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  color: #0f766e;
  background: #ccfbf1;
  font-size: 0.64rem;
  font-weight: 800;
}

.analytics-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 0.5rem;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.analytics-profit-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-inline-start: 4px solid #94a3b8;
}

.analytics-profit-note h2 {
  margin: 0;
  color: var(--analytics-ink);
  font-size: 1rem;
}

.analytics-profit-note p {
  margin: 0.35rem 0 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.6;
}

.analytics-profit-note > span {
  display: inline-flex;
  min-height: 30px;
  padding: 0 0.65rem;
  align-items: center;
  border-radius: 999px;
  color: #475569;
  background: #f1f5f9;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.analytics-table-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.analytics-table-tools .admin-field {
  width: min(100%, 440px);
}

.analytics-table-tools > span {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 750;
}

.analytics-table tr[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .analytics-hero,
  .analytics-profit-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .analytics-hero__actions {
    width: 100%;
  }

  .analytics-hero__actions .admin-btn {
    flex: 1 1 0;
  }

  .analytics-language-switch {
    flex: 1 1 100%;
    justify-content: center;
  }

  .analytics-custom-period {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-custom-period .admin-btn {
    grid-column: 1 / -1;
  }

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

@media (max-width: 680px) {
  .analytics-hero {
    padding: 1.1rem;
  }

  .analytics-hero__actions,
  .analytics-chart-legend,
  .analytics-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-hero__actions .admin-btn,
  .analytics-chart-legend button {
    width: 100%;
  }

  .analytics-language-switch {
    width: 100%;
    box-sizing: border-box;
  }

  .analytics-section-nav {
    top: 0.35rem;
    margin-inline: -0.25rem;
    border-radius: 12px;
  }

  .analytics-kpis,
  .analytics-rate-grid,
  .analytics-status-grid,
  .analytics-split-grid,
  .analytics-custom-period {
    grid-template-columns: 1fr;
  }

  .analytics-kpi {
    min-height: 125px;
  }

  .analytics-ranking li {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .analytics-ranking li strong {
    grid-column: 2;
  }

  .analytics-profit-note > span {
    white-space: normal;
  }
}

@media print {
  .admin-analytics {
    color: #000;
  }

  .admin-analytics .admin-no-print,
  .analytics-filter,
  .analytics-section-nav,
  #order-list,
  #sources,
  .analytics-profit-note {
    display: none !important;
  }

  .analytics-hero {
    margin-bottom: 10px;
    padding: 12px;
    color: #000;
    background: #fff;
    border: 1px solid #cbd5e1;
    box-shadow: none;
  }

  .analytics-hero__eyebrow,
  .analytics-hero p {
    color: #334155;
  }

  .analytics-section {
    margin-bottom: 12px;
    break-inside: avoid;
  }

  .analytics-kpis {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .analytics-kpi,
  .analytics-rate-card,
  .analytics-mini-kpis article,
  .analytics-status,
  .analytics-ranking {
    min-height: auto;
    padding: 7px;
    break-inside: avoid;
    box-shadow: none;
  }

  .analytics-kpi strong,
  .analytics-rate-card strong,
  .analytics-mini-kpis strong {
    font-size: 12pt;
  }

  .analytics-chart-card {
    break-inside: avoid;
  }

  .analytics-chart {
    min-width: 0;
    min-height: 210px;
  }

  .analytics-status-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .analytics-split-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-table {
    min-width: 0;
    font-size: 7pt;
  }

  .analytics-product {
    min-width: 0;
  }

  .analytics-product img {
    display: none;
  }
}
