/* mw-table.css — Orders table, date picker and multi-select styles (based on mockups) */
:root {
  --primary: #78a22f;
  --primary-dark: #5f8226;
  --muted: #6b7280;
  --border: #e6f0e0;
}

/* Heading */
.orders-page {
  font-size: 13px;
}
.orders-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 26px 10px;
}
.orders-heading h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #1f2937;
}
.orders-count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  margin-left: 8px;
}

/* Card wrapper */
.orders-card {
  background: #fff;
  border: 1px solid #e9efe1;
  border-radius: 8px;
  margin: 0;
  overflow: visible;
}

/* Filter bar */
.orders-filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  flex-wrap: wrap;
  overflow: visible;
}
/* Uniform font for all filter bar components */
.orders-filter-bar,
.orders-filter-bar input,
.orders-filter-bar select,
.orders-filter-bar button,
.orders-filter-bar .field-label,
.orders-filter-bar .field-value,
.orders-filter-bar .multi-select-button,
.orders-filter-bar .multi-select-row,
.orders-filter-bar .multi-select-row .label {
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.2;
}
.orders-filter-bar .orders-search {
  flex: 1 1 320px;
  min-width: 240px;
  position: relative;
}
.orders-search input[type="search"] {
  width: 100%;
  height: 30px;
  padding: 6px 8px 6px 34px;
  border-radius: 0;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 13px;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.orders-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23888"><path d="M21 20l-5.6-5.6a7 7 0 10-1.4 1.4L20 21l1-1zM4 11a7 7 0 1114 0A7 7 0 014 11z"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
}
.search-btn {
  flex: 0 0 auto;
  height: 30px;
  color: var(--primary);
  background: #fff;
  font-weight: 800;
  padding: 5px 8px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 13px;
  box-sizing: border-box;
}
.orders-filter-bar .search-btn {
  height: 30px;
  align-self: center;
}
.search-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Field-select combined label/value */
.field-select,
.field-select-static {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 4px 10px;
  min-width: 160px;
  flex: 0 0 200px;
  cursor: pointer;
  box-sizing: border-box;
}
.field-label {
  font-size: 13px;
  font-weight: 800;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  margin-right: 10px;
}
.field-value {
  color: #9ca3af;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.caret {
  margin-left: auto;
  color: #6b7280;
  font-size: 13px;
}

/* Date panel (popover containing two calendars) */
.date-popover {
  position: absolute;
  top: 46px;
  left: 0;
  z-index: 1200;
  background: #fff;
  border: 1px solid #e6efe0;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
  padding: 12px;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.date-popover.open {
  display: grid;
}
.date-popover .date-column {
  min-width: 220px;
}
.flatpickr-calendar {
  border: 1px solid #e6efe0;
  background: #fff;
  z-index: 1200;
}
.flatpickr-day.today {
  background: var(--primary);
  color: #fff;
}
.flatpickr-clear {
  color: var(--primary);
  font-weight: 700;
}

/* Invisible input overlay used for range picker */
.field-date-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* Flatpickr theme overrides for Appian-like look */
.mw-flatpickr {
  font-size: 13px;
}
.mw-flatpickr .flatpickr-current-month,
.mw-flatpickr .flatpickr-monthDropdown-months,
.mw-flatpickr .numInput {
  font-size: 14px;
  font-weight: 800;
}
.mw-flatpickr .flatpickr-months {
  display: flex;
  gap: 12px;
  padding: 6px 8px;
  align-items: center;
}
.mw-flatpickr .flatpickr-month {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mw-flatpickr .flatpickr-weekday {
  color: #6b7280;
  font-weight: 700;
  font-size: 13px;
}
.mw-flatpickr .flatpickr-day {
  width: 36px;
  height: 36px;
  line-height: 36px;
  margin: 2px;
  border-radius: 6px;
  font-size: 13px;
}
/* Selected period highlighted */
.mw-flatpickr .flatpickr-day.inRange,
.mw-flatpickr .flatpickr-day.inRange:hover {
  background: #dcefc6 !important;
  border-color: #dcefc6 !important;
  color: #27402b !important;
  box-shadow: none !important;
  font-weight: 700;
}
.mw-flatpickr .flatpickr-day.selected,
.mw-flatpickr .flatpickr-day.startRange,
.mw-flatpickr .flatpickr-day.endRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  box-shadow: none;
  font-weight: 800;
}
.mw-flatpickr .flatpickr-day.selected:hover,
.mw-flatpickr .flatpickr-day.startRange:hover,
.mw-flatpickr .flatpickr-day.endRange:hover {
  background: var(--primary) !important;
  color: #fff !important;
}
.mw-flatpickr .flatpickr-day.today {
  box-shadow: inset 0 0 0 2px rgba(120, 162, 47, 0.12);
}
.mw-flatpickr .flatpickr-calendar {
  border-radius: 8px;
  padding: 8px;
}
.fp-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid #eef4e3;
  background: #fff;
}
.fp-btn {
  background: transparent;
  border: 0;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.fp-btn:hover {
  background: rgba(120, 162, 47, 0.08);
}

/* Reusable multi-select filter widget (mw-filters.js) */
.mw-multiselect {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  font-size: 13px;
}
.mw-multiselect .multi-select-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-width: 0;
  height: 30px;
  padding: 4px 10px;
  white-space: nowrap;
  text-align: left;
  font-size: 13px;
  line-height: 1;
  box-sizing: border-box;
}
.mw-multiselect .multi-select-button .field-label {
  margin-right: 0;
}
.mw-multiselect .multi-select-button .caret {
  margin-left: 6px;
}
.mw-multiselect .multi-select-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: 360px;
  max-height: 280px;
  overflow: auto;
  z-index: 3000;
  font-size: 13px;
}
.mw-multiselect .multi-select-panel.open {
  display: block;
}
.mw-multiselect .field-value {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  max-width: none;
  font-size: 13px;
}
.mw-multiselect .field-value.has-value {
  color: #27402b;
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}
.mw-multiselect .multi-select-row {
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}
.mw-multiselect .multi-select-row .label {
  font-weight: 700;
  color: #27402b;
  font-size: 13px;
}
.mw-multiselect .multi-select-empty {
  padding: 12px;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
}

/* Multi-select */
.store-multi-select {
  position: relative;
}
.multi-select-button {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  min-width: 200px;
  box-sizing: border-box;
}
.multi-select-panel {
  position: absolute;
  top: 46px;
  left: 0;
  width: 320px;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e9efe1;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
  padding: 6px 6px;
  display: none;
  z-index: 1200;
}
.multi-select-panel.open {
  display: block;
}
.multi-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
}
.multi-select-row .label {
  font-weight: 700;
  color: #27402b;
}
.multi-select-row:hover {
  background: #f6fff3;
}
.multi-select-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Table */
.orders-table {
  width: 100%;
  min-width: 1150px;
  border-collapse: collapse;
}
.orders-table th {
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #eef2e9;
  padding: 6px 14px;
  vertical-align: top;
}
.orders-table td {
  padding: 6px 14px;
  border-bottom: 1px solid #f0f1ee;
  color: #374151;
  vertical-align: top;
  font-size: 13px;
}
.orders-table td.text-right,
.orders-table td.amount,
.orders-table td.numeric {
  text-align: right;
}
.orders-table td.center,
.orders-table td.badge-cell {
  text-align: center;
}
.orders-table tr:hover td {
  background: #fbfff9;
}
.cell-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dotted var(--primary);
}
.name-link {
  font-weight: 700;
  color: #27402b;
}

/* Badges */
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  background: linear-gradient(180deg, #a7f3d0, #34d399);
  color: #065f46;
  font-size: 13px;
  font-weight: 800;
}
.channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 4px;
  background: #eaf3dd;
  color: #4f7a2a;
  border: 1px solid #c7e0a3;
  font-weight: 800;
}

/* Helpers */
.help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  margin-left: 6px;
}
.pagination-row {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
@media (max-width: 1100px) {
  .orders-table {
    min-width: 900px;
  }
  .orders-filter-bar {
    flex-wrap: wrap;
  }
  .field-select {
    flex: 1 1 200px;
  }
}

/* Column sizing to match admin mockup */
.orders-table th:nth-child(1),
.orders-table td:nth-child(1) {
  width: 120px;
}
.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
  width: 220px;
}
.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 120px;
}
.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
  width: 100px;
}
.orders-table th:nth-child(5),
.orders-table td:nth-child(5) {
  width: 130px;
}
.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  width: 120px;
}
.orders-table th:nth-child(7),
.orders-table td:nth-child(7) {
  width: 140px;
}
.orders-table th:nth-child(8),
.orders-table td:nth-child(8) {
  width: 120px;
}
.orders-table th:nth-child(9),
.orders-table td:nth-child(9) {
  width: 140px;
}
.orders-table th:nth-child(10),
.orders-table td:nth-child(10) {
  width: 90px;
}
.orders-table th:nth-child(11),
.orders-table td:nth-child(11) {
  width: 70px;
}

/* Remove border-radius on form controls to match flat design */
.orders-page input,
.orders-page textarea,
.orders-page select,
.orders-page .field-select,
.orders-page .field-select-static,
.orders-page .multi-select-button,
.orders-page .search-btn,
.orders-page .orders-search input[type="search"],
.orders-page .field-date-input {
  border-radius: 0 !important;
}
