:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #101828;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e4e7ec;
  --navy: #0B1F3B;
  --navy-2: #132D50;
  --accent: #B87333;
  --accent-soft: #F8F5EE;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #168a55;
  --green-soft: #ecfdf3;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b42318;
  --red-soft: #fef3f2;
  --purple: #6941c6;
  --purple-soft: #f4f3ff;
  --shadow-sm: 0 4px 16px rgba(16, 24, 40, .045);
  --shadow: 0 14px 36px rgba(16, 24, 40, .08);
  --shadow-lg: 0 30px 80px rgba(16, 24, 40, .22);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.overlay-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #98a2b3;
  box-shadow: 0 0 0 4px rgba(152, 162, 179, .12);
}

textarea {
  resize: vertical;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -.025em;
}

.app-width {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid rgba(228, 231, 236, .9);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

.brand-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.015em;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

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

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a2b3;
}

.sync-state.live .sync-dot {
  background: #12b76a;
  box-shadow: 0 0 0 4px rgba(18,183,106,.12);
}

.sync-state.busy .sync-dot {
  background: #f59e0b;
}

.sync-state.error .sync-dot {
  background: #f04438;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  padding: 0;
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.app-main {
  padding: 24px 0 88px;
}

.welcome-strip {
  border-radius: 20px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #0b1220, #1b263a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow);
}

.welcome-strip h1 {
  font-size: clamp(23px, 3vw, 32px);
  margin-bottom: 5px;
}

.welcome-strip .muted {
  color: #cbd5e1;
  margin-bottom: 0;
}

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 6px;
}

.welcome-strip .eyebrow {
  color: #aebbd0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.role-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.role-pill {
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  color: #fff;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
}

.notice {
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 12px;
  line-height: 1.55;
  margin: 14px 0;
}

.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.notice-warning {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.notice-error {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #fecdca;
}

.desktop-tabs {
  margin: 24px 0 0;
  display: flex;
  gap: 5px;
  width: fit-content;
  padding: 4px;
  background: #e9edf2;
  border-radius: 13px;
}

.workspace-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 800;
}

.workspace-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(16,24,40,.07);
}

.workspace-view {
  min-height: 420px;
}

.section-title-row {
  margin: 26px 0 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.section-title-row h2 {
  font-size: 23px;
  margin-bottom: 3px;
}

.section-title-row p {
  margin-bottom: 0;
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

.button-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 7px 17px rgba(11,18,32,.12);
}

.button-secondary {
  background: #eef2f6;
  color: #344054;
}

.button-full {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.new-order-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, #fff7ed, #fff);
  border: 1px solid #fed7aa;
  border-radius: 15px;
  padding: 13px 14px;
  margin-bottom: 13px;
}

.new-order-banner div {
  display: grid;
  gap: 2px;
}

.new-order-banner strong {
  color: #9a3412;
  font-size: 13px;
}

.new-order-banner span {
  color: #9a3412;
  font-size: 11px;
  opacity: .82;
}

.banner-close {
  border: 0;
  background: transparent;
  color: #9a3412;
  font-size: 22px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.summary-card.pending {
  border-top: 3px solid var(--accent);
}

.summary-card.due,
.summary-card.exception {
  border-top: 3px solid #f59e0b;
}

.summary-card.confirmed {
  border-top: 3px solid var(--blue);
}

.summary-card.transit {
  border-top: 3px solid var(--purple);
}

.summary-value {
  font-size: 25px;
  font-weight: 850;
  line-height: 1;
  margin-bottom: 7px;
}

.summary-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: #eaedf1;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.summary-skeleton {
  height: 78px;
  border-radius: 15px;
}

.order-skeleton {
  height: 190px;
  border-radius: 17px;
  margin-bottom: 10px;
}

.queue-card,
.search-panel,
.helper-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.queue-card {
  margin-bottom: 12px;
  overflow: hidden;
}

.queue-controls {
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  flex: 1;
  min-width: 0;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: #98a2b3;
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 39px;
  background: #f8fafc;
  border-color: transparent;
}

.search-box-large input {
  min-height: 50px;
  font-size: 14px;
}

.queue-count {
  min-width: 115px;
  text-align: right;
  display: grid;
  gap: 1px;
}

.queue-count strong {
  font-size: 12px;
}

.queue-count span {
  color: var(--muted);
  font-size: 10px;
}

.chip-scroll {
  padding: 11px 13px 13px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 800;
}

.filter-chip.active {
  color: #fff;
  border-color: var(--navy);
  background: var(--navy);
}

.search-panel {
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 10px;
  margin-bottom: 12px;
}

.helper-card {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.order-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.order-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.order-card:hover {
  transform: translateY(-1px);
  border-color: #d0d5dd;
  box-shadow: 0 10px 28px rgba(16,24,40,.07);
}

.order-card-head,
.order-identity,
.order-card-actions {
  display: flex;
  align-items: center;
}

.order-card-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.order-identity {
  min-width: 0;
  gap: 7px;
}

.order-id {
  color: #475467;
  font-size: 11px;
  font-weight: 850;
}

.order-age {
  color: var(--subtle);
  font-size: 10px;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 850;
}

.status-badge[data-status="Pending"] {
  background: var(--accent-soft);
  color: #c2410c;
}

.status-badge[data-status="Follow Up"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge[data-status="Confirmed"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-badge[data-status="In Transit"] {
  background: var(--purple-soft);
  color: var(--purple);
}

.status-badge[data-status="Delivered"] {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge[data-status="Rescheduled"] {
  background: #fff7ed;
  color: #c2410c;
}

.status-badge[data-status="Cancelled"],
.status-badge[data-status="Delivery Failed"] {
  background: var(--red-soft);
  color: var(--red);
}

.order-customer {
  font-size: 16px;
  font-weight: 850;
  letter-spacing: -.02em;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-product {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 13px 0;
}

.order-info-grid div {
  min-width: 0;
  background: #f8fafc;
  border-radius: 10px;
  padding: 9px 10px;
}

.order-info-grid span {
  display: block;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 750;
  margin-bottom: 3px;
}

.order-info-grid strong {
  display: block;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-attention {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  border-radius: 9px;
  padding: 9px 10px;
  margin-bottom: 12px;
}

.order-attention.overdue {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.order-attention div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.order-attention strong,
.order-attention b {
  font-size: 10px;
}

.order-attention span {
  color: var(--muted);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-attention b {
  flex: 0 0 auto;
  color: var(--amber);
}

.order-attention.overdue b {
  color: var(--red);
}

.order-card-actions {
  justify-content: flex-end;
  gap: 7px;
}

.compact-action {
  min-height: 38px;
  padding: 9px 11px;
}

.load-more {
  display: flex;
  margin: 16px auto 0;
  min-width: 180px;
}

.empty-state {
  padding: 40px 18px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: #fff;
  text-align: center;
  color: var(--muted);
}

.compact-empty {
  grid-column: 1 / -1;
}

.empty-state h3 {
  color: var(--text);
  margin-bottom: 5px;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 12px;
}

.empty-symbol {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f2f4f7;
  color: var(--muted);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  font-weight: 850;
}

.admin-title {
  margin-top: 36px;
}

.admin-grid {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 12px;
}

.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.form-message {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.rep-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.rep-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rep-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rep-row strong {
  font-size: 12px;
}

.rep-row span,
.rep-row small {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-link-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.setup-link-box label {
  display: grid;
  gap: 6px;
  font-size: 10px;
  font-weight: 800;
}

/* Drawer */
.drawer-backdrop,
.sheet-backdrop,
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.48);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .18s ease;
}

.drawer-backdrop {
  z-index: 80;
}

.sheet-backdrop {
  z-index: 100;
}

.confirm-backdrop {
  z-index: 120;
}

.drawer-backdrop.open,
.sheet-backdrop.open,
.confirm-backdrop.open {
  opacity: 1;
}

.order-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 90;
  width: min(560px, 100%);
  height: 100dvh;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}

.order-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  flex: 0 0 auto;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.drawer-header h2 {
  margin-bottom: 7px;
  font-size: 20px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 30px;
}

.drawer-block + .drawer-block {
  margin-top: 24px;
}

.drawer-block-title {
  color: #475467;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 9px;
}

.drawer-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.detail-list {
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
}

.detail-row {
  display: grid;
  grid-template-columns: 145px minmax(0,1fr);
  gap: 12px;
  padding: 10px 11px;
  background: #fff;
}

.detail-row + .detail-row {
  border-top: 1px solid var(--border);
}

.detail-row span {
  color: var(--muted);
  font-size: 10px;
}

.detail-row strong {
  min-width: 0;
  font-size: 11px;
  text-align: right;
  word-break: break-word;
}

.next-action-card {
  border-radius: 13px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  padding: 12px;
  display: grid;
  gap: 3px;
  font-size: 11px;
}

.next-action-card span {
  color: var(--muted);
}

.next-action-card b {
  color: #c2410c;
  font-size: 10px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-size: 10px;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px minmax(0,1fr);
  gap: 9px;
}

.timeline-dot {
  position: relative;
}

.timeline-dot::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 8px;
  height: 8px;
  background: var(--navy);
  border-radius: 50%;
}

.timeline-dot::after {
  content: "";
  position: absolute;
  top: 17px;
  bottom: -4px;
  left: 9.5px;
  width: 1px;
  background: var(--border);
}

.timeline-item:last-child .timeline-dot::after {
  display: none;
}

.timeline-content {
  padding: 0 0 18px;
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.timeline-top strong {
  font-size: 11px;
}

.timeline-top span,
.timeline-by {
  color: var(--muted);
  font-size: 9px;
}

.timeline-by {
  margin-top: 2px;
}

.timeline-meta {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.timeline-meta span {
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  padding: 4px 6px;
  font-size: 8px;
  font-weight: 700;
}

.timeline-content p {
  margin: 7px 0 0;
  color: #475467;
  font-size: 10px;
  line-height: 1.5;
}

.timeline-content details {
  margin-top: 7px;
}

.timeline-content summary {
  color: var(--blue);
  font-size: 9px;
  font-weight: 750;
  cursor: pointer;
}

.timeline-content pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 9px;
  color: var(--muted);
}

.timeline-loading,
.timeline-empty {
  color: var(--muted);
  font-size: 11px;
  padding: 12px 0;
}

.drawer-footer {
  flex: 0 0 auto;
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: #fff;
}

/* Status sheet */
.status-sheet {
  position: fixed;
  z-index: 110;
  left: 50%;
  bottom: 0;
  width: min(760px, 100%);
  max-height: 92dvh;
  transform: translate(-50%, 105%);
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}

.status-sheet.open {
  transform: translate(-50%, 0);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: #d0d5dd;
  margin: 8px auto 3px;
}

.sheet-header {
  padding: 10px 18px 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sheet-header h2 {
  font-size: 20px;
  margin-bottom: 3px;
}

.sheet-header p {
  margin-bottom: 0;
}

.sheet-body {
  overflow-y: auto;
  padding: 16px 18px max(24px, env(safe-area-inset-bottom));
}

.field-heading {
  font-size: 11px;
  font-weight: 850;
  color: #475467;
  margin-bottom: 10px;
}

.status-choice-grid {
  display: grid;
  gap: 8px;
}

.status-choice {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 13px;
  padding: 11px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.status-choice:hover {
  border-color: #cbd5e1;
  background: #fbfcfd;
}

.status-choice > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.status-choice strong {
  font-size: 11px;
}

.status-choice small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.status-choice b {
  color: var(--subtle);
  font-size: 20px;
}

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

.form-field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field > span {
  color: #344054;
  font-size: 10px;
  font-weight: 800;
}

.form-field em {
  color: var(--red);
  font-style: normal;
  font-size: 8px;
}

.field-hint {
  color: var(--muted);
  font-size: 9px;
}

.form-section-title {
  color: #475467;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding-top: 4px;
}

.checkbox-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px;
  font-size: 10px;
  font-weight: 700;
}

.checkbox-field input {
  width: 17px;
  height: 17px;
  margin: 0;
  flex: 0 0 auto;
  box-shadow: none;
}

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

.form-callout {
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 10px;
  line-height: 1.5;
}

.form-callout.warning {
  background: var(--amber-soft);
  color: #92400e;
}

.sheet-actions {
  position: sticky;
  bottom: -24px;
  margin: 16px -18px -24px;
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  backdrop-filter: blur(10px);
}

/* Confirmation */
.confirm-dialog {
  position: fixed;
  z-index: 130;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100% - 28px));
  transform: translate(-50%, -46%) scale(.98);
  opacity: 0;
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transition: transform .16s ease, opacity .16s ease;
}

.confirm-dialog.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.confirm-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 900;
  margin-bottom: 12px;
}

.confirm-dialog h3 {
  margin-bottom: 7px;
}

.confirm-dialog p {
  font-size: 11px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Mobile navigation */
.mobile-nav {
  position: fixed;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  z-index: 60;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  min-height: 62px;
  padding: 6px;
  border: 1px solid rgba(228,231,236,.92);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 45px rgba(16,24,40,.17);
  backdrop-filter: blur(14px);
}

.mobile-nav-item {
  border: 0;
  background: transparent;
  color: #667085;
  border-radius: 13px;
  min-height: 50px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 800;
}

.mobile-nav-item svg {
  width: 18px;
  height: 18px;
}

.mobile-nav-item.active {
  color: var(--navy);
  background: #f2f4f7;
}

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px));
  transform: translate(-50%, 10px);
  opacity: 0;
  max-width: min(420px, calc(100% - 28px));
  padding: 10px 13px;
  border-radius: 11px;
  background: #101828;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 721px) {
  .mobile-nav {
    display: none !important;
  }
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }

  .order-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .app-width {
    width: min(100% - 20px, 1180px);
  }

  .app-topbar {
    position: sticky;
  }

  .topbar-inner {
    min-height: 62px;
  }

  .brand-sub,
  .sync-state span:last-child {
    display: none;
  }

  .app-main {
    padding-top: 14px;
    padding-bottom: 98px;
  }

  .welcome-strip {
    border-radius: 17px;
    padding: 17px;
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .welcome-strip h1 {
    font-size: 22px;
  }

  .role-list {
    justify-content: flex-start;
  }

  .desktop-tabs {
    display: none;
  }

  .section-title-row {
    margin-top: 22px;
    align-items: center;
  }

  .section-title-row h2 {
    font-size: 20px;
  }

  .section-title-row p {
    max-width: 260px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 7px;
  }

  .summary-card {
    padding: 11px;
    border-radius: 13px;
  }

  .summary-value {
    font-size: 21px;
  }

  .summary-label {
    font-size: 9px;
  }

  .queue-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-count {
    min-width: 0;
    text-align: left;
    grid-template-columns: auto 1fr;
    gap: 8px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .order-card {
    padding: 13px;
  }

  .order-info-grid {
    margin: 11px 0;
  }

  .order-card-actions {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .order-card-actions .button:only-child {
    grid-column: 1 / -1;
  }

  .compact-action {
    min-height: 44px;
  }

  .order-drawer {
    width: 100%;
  }

  .drawer-header {
    padding-top: max(15px, env(safe-area-inset-top));
  }

  .drawer-body {
    padding: 14px 14px 28px;
  }

  .drawer-footer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .detail-row {
    grid-template-columns: 115px minmax(0,1fr);
  }

  .status-sheet {
    max-height: 96dvh;
    border-radius: 18px 18px 0 0;
  }

  .sheet-header,
  .sheet-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .form-grid,
  .conditional-grid {
    grid-template-columns: 1fr;
  }

  .form-field-full,
  .checkbox-field {
    grid-column: auto;
  }

  .sheet-actions {
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .sheet-actions .button {
    flex: 1;
    min-height: 46px;
  }

  .confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

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

  .order-identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .order-card-head {
    align-items: flex-start;
  }
}

/* =========================================================
   V4 — Scalable operational data-grid experience
   ========================================================= */

/* Responsive authentication */
.auth-body {
  background:
    radial-gradient(circle at top left, rgba(249,115,22,.08), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, #f4f6f8 100%);
}

.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
}

.auth-card-v4 {
  width: min(100%, 430px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(16,24,40,.11);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 30px;
}

.auth-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.auth-brand-name {
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -.02em;
}

.auth-brand-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

.auth-heading h1 {
  margin-bottom: 7px;
  font-size: 28px;
}

.auth-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field > span {
  color: #344054;
  font-size: 11px;
  font-weight: 800;
}

.auth-field input {
  min-height: 48px;
  font-size: 16px;
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #475467;
  padding: 8px;
  font-size: 11px;
  font-weight: 800;
}

.auth-submit {
  min-height: 49px;
  margin-top: 2px;
}

.auth-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.auth-message.error {
  color: var(--red);
}

.auth-message.success {
  color: var(--green);
}

.auth-footnote {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  text-align: center;
  font-size: 10px;
}

/* Compact global header */
.topbar-compact {
  min-height: 62px;
}

.brand-compact {
  min-width: 0;
  flex: 1;
}

.brand-copy {
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.business-date {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.header-user {
  max-width: min(620px, 60vw);
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user strong {
  color: #344054;
  font-weight: 850;
}

.app-main-compact {
  padding-top: 10px;
}

.workspace-nav-row {
  display: flex;
  justify-content: flex-start;
}

.desktop-tabs-compact {
  margin-top: 4px;
}

.section-title-compact {
  margin: 14px 0 10px;
}

.workspace-title {
  margin-bottom: 2px;
  font-size: 23px;
}

.button-small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 10px;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Metrics: one compact strip instead of a tall dashboard block */
.summary-strip {
  margin-bottom: 10px;
}

.summary-strip .summary-card {
  padding: 11px 12px;
}

.summary-strip .summary-value {
  font-size: 22px;
  margin-bottom: 5px;
}

.queue-card-compact {
  margin-bottom: 10px;
}

.queue-controls-compact {
  padding: 10px 11px;
}

.filter-stack {
  border-top: 1px solid var(--border);
  padding: 8px 10px 10px;
  display: grid;
  gap: 7px;
}

.filter-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.filter-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.search-panel-v4 {
  grid-template-columns: minmax(0,1fr) 190px 170px;
  gap: 9px;
  margin-bottom: 10px;
}

/* Airtable / spreadsheet inspired operational grid */
.data-grid-host {
  min-width: 0;
}

.data-grid-shell {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-grid-scroll {
  overflow: auto;
  max-height: calc(100dvh - 285px);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.orders-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #fff;
}

.orders-table th,
.orders-table td {
  border-bottom: 1px solid #edf0f3;
  border-right: 1px solid #f0f2f5;
  padding: 10px 11px;
  text-align: left;
  vertical-align: middle;
}

.orders-table th:last-child,
.orders-table td:last-child {
  border-right: 0;
}

.orders-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  color: #667085;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .055em;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--border);
}

.orders-table tbody tr {
  cursor: pointer;
  transition: background .12s ease;
}

.orders-table tbody tr:hover td {
  background: #fbfcfd;
}

.orders-table tbody tr:focus-visible {
  outline: 2px solid #98a2b3;
  outline-offset: -2px;
}

.orders-table tbody tr:last-child td {
  border-bottom: 0;
}

.orders-table th.col-order,
.orders-table td.col-order {
  position: sticky;
  left: 0;
  width: 150px;
  z-index: 3;
  background: #fff;
  box-shadow: 1px 0 0 #edf0f3;
}

.orders-table thead th.col-order {
  z-index: 7;
  background: #f8fafc;
}

.orders-table th.col-customer { width: 210px; }
.orders-table th.col-product { width: 220px; }
.orders-table th.col-amount { width: 120px; }
.orders-table th.col-location { width: 170px; }
.orders-table th.col-status { width: 150px; }
.orders-table th.col-next { width: 185px; }
.orders-table th.col-created { width: 130px; }

.orders-table th.col-actions,
.orders-table td.col-actions {
  position: sticky;
  right: 0;
  width: 118px;
  z-index: 3;
  background: #fff;
  box-shadow: -1px 0 0 #edf0f3;
}

.orders-table thead th.col-actions {
  z-index: 7;
  background: #f8fafc;
}

.order-link {
  display: inline-flex;
  border: 0;
  background: transparent;
  color: #1d4ed8;
  padding: 0;
  font-size: 11px;
  font-weight: 850;
  text-align: left;
}

.cell-primary {
  display: block;
  min-width: 0;
  color: #1d2939;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-secondary {
  display: block;
  margin-top: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-amount {
  color: #101828;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.next-action-cell {
  display: grid;
  gap: 2px;
}

.next-action-cell.overdue .cell-secondary {
  color: var(--red);
  font-weight: 800;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.row-action {
  min-height: 32px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 9px;
}

.row-action-call {
  width: 32px;
  min-width: 32px;
  padding: 0;
  text-decoration: none;
}

.new-row-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #c2410c;
  padding: 2px 5px;
  font-size: 7px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Center status workflow on desktop; near-full-screen on mobile. */
.status-sheet {
  top: 50%;
  bottom: auto;
  width: min(760px, calc(100% - 28px));
  max-height: min(88dvh, 860px);
  transform: translate(-50%, -46%) scale(.985);
  opacity: 0;
  border-radius: 20px;
  transition: transform .18s ease, opacity .18s ease;
}

.status-sheet.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.sheet-handle {
  display: none;
}

.sheet-header {
  padding-top: 16px;
}

.sheet-body {
  padding-bottom: 18px;
}

.sheet-actions {
  bottom: -18px;
  margin-bottom: -18px;
}

/* Completed action confirmation */
.success-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .16s ease;
}

.success-backdrop.open {
  opacity: 1;
}

.success-dialog {
  position: fixed;
  z-index: 150;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100% - 28px));
  transform: translate(-50%, -46%) scale(.985);
  opacity: 0;
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  transition: transform .16s ease, opacity .16s ease;
}

.success-dialog.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.success-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}

.success-dialog h3 {
  margin-bottom: 12px;
}

.success-summary {
  margin-bottom: 17px;
  border: 1px solid var(--border);
  border-radius: 13px;
  overflow: hidden;
}

.success-summary-row {
  display: grid;
  grid-template-columns: 110px minmax(0,1fr);
  gap: 10px;
  padding: 9px 10px;
  font-size: 10px;
}

.success-summary-row + .success-summary-row {
  border-top: 1px solid var(--border);
}

.success-summary-row span {
  color: var(--muted);
}

.success-summary-row strong {
  text-align: right;
  word-break: break-word;
}

/* Keep overlay layering predictable */
body.overlay-open .mobile-nav {
  pointer-events: none;
}

@media (max-width: 980px) {
  .search-panel-v4 {
    grid-template-columns: minmax(0,1fr) 160px 150px;
  }

  .data-grid-scroll {
    max-height: calc(100dvh - 300px);
  }
}

@media (max-width: 720px) {
  .auth-page {
    align-items: center;
    padding-left: 12px;
    padding-right: 12px;
  }

  .auth-card-v4 {
    width: 100%;
    padding: 22px 18px;
    border-radius: 18px;
  }

  .auth-brand {
    margin-bottom: 24px;
  }

  .auth-heading h1 {
    font-size: 25px;
  }

  .topbar-compact {
    min-height: 64px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    font-size: 13px;
  }

  .brand-title-row {
    gap: 6px;
  }

  .brand-name {
    font-size: 13px;
  }

  .business-date {
    font-size: 8px;
  }

  .header-user {
    max-width: calc(100vw - 120px);
    font-size: 8.5px;
  }

  .sync-state {
    width: 10px;
  }

  .sync-state span:last-child {
    display: none;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .app-main-compact {
    padding-top: 7px;
  }

  .section-title-compact {
    margin-top: 9px;
    margin-bottom: 8px;
  }

  .workspace-title {
    font-size: 19px;
  }

  .section-title-compact p {
    display: none;
  }

  .summary-strip {
    display: flex;
    grid-template-columns: none;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .summary-strip::-webkit-scrollbar {
    display: none;
  }

  .summary-strip .summary-card,
  .summary-strip .summary-skeleton {
    min-width: 104px;
    flex: 0 0 104px;
    scroll-snap-align: start;
  }

  .queue-controls-compact {
    gap: 8px;
  }

  .queue-count {
    display: flex;
    justify-content: space-between;
  }

  .filter-stack {
    padding-left: 8px;
    padding-right: 8px;
  }

  .filter-line {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .filter-label {
    font-size: 8px;
  }

  .search-panel-v4 {
    grid-template-columns: 1fr 1fr;
  }

  .search-panel-v4 .search-box {
    grid-column: 1 / -1;
  }

  .data-grid-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .orders-table {
    min-width: 900px;
  }

  .orders-table th,
  .orders-table td {
    padding: 9px 9px;
  }

  .orders-table th.col-order,
  .orders-table td.col-order {
    width: 132px;
  }

  .orders-table th.col-actions,
  .orders-table td.col-actions {
    width: 108px;
  }

  .status-sheet {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    max-height: none;
    transform: translateY(12px) scale(.99);
    border-radius: 18px;
  }

  .status-sheet.open {
    transform: translateY(0) scale(1);
  }

  .sheet-header {
    padding-top: 13px;
  }

  .sheet-body {
    flex: 1;
  }

  .success-dialog {
    width: calc(100% - 24px);
    padding: 19px;
  }

  .success-summary-row {
    grid-template-columns: 95px minmax(0,1fr);
  }

  .new-order-banner {
    align-items: flex-start;
  }

  .banner-actions {
    flex: 0 0 auto;
  }
}

@media (max-width: 380px) {
  .business-date {
    display: none;
  }

  .search-panel-v4 {
    grid-template-columns: 1fr;
  }

  .search-panel-v4 .search-box {
    grid-column: auto;
  }

  .filter-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 720px) {
  /* Keep the Order column anchored like a spreadsheet, but let the action
     column scroll so the phone still has useful horizontal workspace. */
  .orders-table th.col-actions,
  .orders-table td.col-actions {
    position: static;
    box-shadow: none;
  }

  .orders-table thead th.col-actions {
    background: #f8fafc;
  }
}

.grid-loading-shell {
  padding-bottom: 1px;
}

.grid-loading-header {
  height: 36px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.grid-loading-row {
  height: 46px;
  border-radius: 0;
  border-bottom: 1px solid #edf0f3;
}


/* =========================================================
   V5 — dense operations grid + direct workflow controls
   ========================================================= */

/* Use the available width: status and date filters share one row. */
.filter-stack {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.filter-line {
  min-width: 0;
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
}

.filter-line:first-child {
  flex: 1.35 1 0;
}

.filter-line:last-child {
  flex: 1 1 0;
}

.filter-label {
  flex: 0 0 auto;
}

.chip-scroll {
  flex: 1 1 auto;
  min-width: 0;
}

/* More rows visible: the grid is the primary workspace. */
.data-grid-scroll {
  height: 70vh;
  min-height: 520px;
  max-height: 780px;
}

.orders-table th,
.orders-table td {
  padding: 7px 8px;
}

.orders-table tbody tr {
  height: 39px;
}

.orders-table thead th {
  height: 34px;
}

/* Spreadsheet row-number gutter. */
.orders-table th.col-index,
.orders-table td.col-index {
  position: sticky;
  left: 0;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  z-index: 6;
  padding-left: 6px;
  padding-right: 6px;
  background: #f8fafc;
  color: #98a2b3;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  box-shadow: 1px 0 0 #e4e7ec;
}

.orders-table td.col-index {
  z-index: 5;
  background: #fbfcfd;
}

.orders-table th.col-order,
.orders-table td.col-order {
  left: 42px;
}

.orders-table thead th.col-index {
  z-index: 9;
}

/* Clickable, accessible spreadsheet headers. */
.sort-header {
  width: 100%;
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  text-transform: inherit;
  letter-spacing: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}

.sort-header b {
  color: #b0b7c3;
  font-size: 10px;
  font-weight: 900;
}

.sort-header:hover,
.sort-header.active {
  color: #344054;
}

.sort-header.active b {
  color: #2563eb;
}

/* Every workflow state gets a unique visual identity. */
.status-badge[data-status="Pending"] {
  background: #fff4cc;
  color: #8a5b00;
}
.status-badge[data-status="Follow Up"] {
  background: #e8f1ff;
  color: #175cd3;
}
.status-badge[data-status="Confirmed"] {
  background: #e8f8f3;
  color: #087a5b;
}
.status-badge[data-status="In Transit"] {
  background: #efe8ff;
  color: #6941c6;
}
.status-badge[data-status="Delivered"] {
  background: #dcfae6;
  color: #067647;
}
.status-badge[data-status="Rescheduled"] {
  background: #ffead5;
  color: #b54708;
}
.status-badge[data-status="Cancelled"] {
  background: #fee4e2;
  color: #b42318;
}
.status-badge[data-status="Delivery Failed"] {
  background: #ffe4e8;
  color: #c01048;
}

/* KPI cards show both count and rate without getting taller. */
.summary-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.summary-rate {
  color: #475467;
  font-size: 10px;
  font-weight: 900;
}

.summary-foot {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 8px;
  font-weight: 700;
}

/* Direct workflow controls in the side panel — no extra status-choice step. */
.drawer-footer-actions {
  display: grid;
  gap: 8px;
}

.drawer-action-heading {
  color: #667085;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.drawer-status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.drawer-status-action {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 9px;
  background: #f2f4f7;
  color: #344054;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}

.drawer-status-action:hover {
  filter: brightness(.985);
  transform: translateY(-1px);
}

.drawer-status-action[data-status="Follow Up"] {
  background: #e8f1ff;
  color: #175cd3;
  border-color: #c9dcff;
}
.drawer-status-action[data-status="Confirmed"] {
  background: #e8f8f3;
  color: #087a5b;
  border-color: #c4eddf;
}
.drawer-status-action[data-status="In Transit"] {
  background: #efe8ff;
  color: #6941c6;
  border-color: #d9ceff;
}
.drawer-status-action[data-status="Delivered"] {
  background: #dcfae6;
  color: #067647;
  border-color: #b9efca;
}
.drawer-status-action[data-status="Rescheduled"] {
  background: #ffead5;
  color: #b54708;
  border-color: #ffd1a4;
}
.drawer-status-action[data-status="Cancelled"] {
  background: #fee4e2;
  color: #b42318;
  border-color: #fecdca;
}
.drawer-status-action[data-status="Delivery Failed"] {
  background: #ffe4e8;
  color: #c01048;
  border-color: #fecdd6;
}

.drawer-closed-state {
  grid-column: 1 / -1;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  color: #667085;
  font-size: 10px;
  text-align: center;
}

/* Required activity note has an obvious visual cue. */
#activityNoteLabel em {
  color: #b42318;
  font-style: normal;
  font-size: 8px;
}

/* Reduce unnecessary modal step chrome. */
#statusChoiceStep {
  display: none !important;
}

@media (max-width: 980px) {
  .data-grid-scroll {
    height: 64vh;
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .filter-stack {
    display: grid;
    gap: 6px;
  }

  .filter-line {
    width: 100%;
  }

  .data-grid-scroll {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .orders-table th.col-order,
  .orders-table td.col-order {
    left: 42px;
  }

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

@media (max-width: 390px) {
  .drawer-status-actions {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   V6 — command-bar layout, wider grid, 100-row batches
   ========================================================= */
.app-width {
  width: min(1760px, calc(100% - 16px));
}

.topbar-inner {
  min-height: 58px;
  gap: 10px;
}

.topbar-workspace-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.topbar-workspace-tab {
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  font-size: 10px;
  font-weight: 850;
}

.topbar-workspace-tab:hover { background: #f2f4f7; color: #344054; }
.topbar-workspace-tab.active { background: #eef2f7; color: #101828; }

.app-main-compact { padding-top: 6px; }
.workspace-view { margin-top: 6px; }

.summary-strip { margin-bottom: 6px; }
.summary-strip .summary-card { padding: 8px 10px; min-height: 58px; }
.summary-strip .summary-value { font-size: 19px; margin-bottom: 1px; }
.summary-label { font-size: 8px; }

.work-command-bar,
.history-command-bar,
.search-command-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  margin-bottom: 6px;
  padding: 6px 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.work-command-search {
  flex: 0 1 220px;
  min-width: 150px;
}
.work-command-search input { min-height: 30px; }

.work-status-inline, .history-status-inline {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.work-status-inline::-webkit-scrollbar, .history-status-inline::-webkit-scrollbar { display: none; }

.work-status-inline .filter-chip,
.history-status-inline .filter-chip {
  min-height: 28px;
  padding: 5px 8px;
  white-space: nowrap;
  font-size: 9px;
}

.compact-filter-select {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #667085;
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.compact-filter-select select {
  width: 142px;
  min-height: 30px;
  padding: 5px 26px 5px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 750;
  text-transform: none;
  letter-spacing: 0;
}

.work-command-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}
.queue-count { line-height: 1.15; min-width: 92px; }
.queue-count strong { font-size: 9px; white-space: nowrap; }
.queue-count span { font-size: 8px; }
.compact-refresh { min-height: 30px; padding: 5px 8px; font-size: 9px; }

.search-command-bar {
  grid-template-columns: none;
}
.search-command-bar .search-box { flex: 1 1 420px; }
.search-command-bar select { flex: 0 0 165px; min-height: 31px; }
.history-command-search { flex: 0 1 260px; }

.data-grid-scroll {
  height: calc(100dvh - 188px);
  min-height: 560px;
  max-height: none;
}

.orders-table {
  width: 100%;
  min-width: 1280px;
  table-layout: fixed;
}

.orders-table th.col-order, .orders-table td.col-order { width: 126px; }
.orders-table th.col-customer { width: 182px; }
.orders-table th.col-product { width: 194px; }
.orders-table th.col-amount { width: 105px; }
.orders-table th.col-location { width: 155px; }
.orders-table th.col-status { width: 126px; }
.orders-table th.col-next { width: 154px; }
.orders-table th.col-created { width: 108px; }
.orders-table th.col-actions, .orders-table td.col-actions { width: 88px; }
.orders-table th, .orders-table td { padding: 6px 7px; }
.orders-table tbody tr { height: 36px; }
.row-action { min-height: 26px; padding: 4px 6px; font-size: 8px; }
.row-action-call { width: 27px; }
.cell-primary, .order-link { font-size: 10px; }
.cell-secondary { font-size: 8px; }
.cell-amount { font-size: 10px; }

/* Side-panel workflow buttons: solid, decisive action colors. */
.drawer-status-action {
  border: 0 !important;
  color: #fff !important;
  font-weight: 900;
  box-shadow: 0 1px 2px rgba(16,24,40,.16);
}
.drawer-status-action[data-status="Follow Up"] { background: #2563eb; }
.drawer-status-action[data-status="Confirmed"] { background: #059669; }
.drawer-status-action[data-status="In Transit"] { background: #7c3aed; }
.drawer-status-action[data-status="Delivered"] { background: #16a34a; }
.drawer-status-action[data-status="Rescheduled"] { background: #ea580c; }
.drawer-status-action[data-status="Cancelled"] { background: #dc2626; }
.drawer-status-action[data-status="Delivery Failed"] { background: #be123c; }
.drawer-status-action:hover { filter: brightness(.93); }

.success-dialog h3 {
  font-size: 18px;
  line-height: 1.25;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 980px) {
  .topbar-workspace-nav { display: none !important; }
  .work-command-bar, .history-command-bar { flex-wrap: wrap; }
  .work-command-search, .history-command-search { flex: 1 1 210px; }
  .work-status-inline, .history-status-inline { order: 3; flex-basis: 100%; }
  .data-grid-scroll { height: calc(100dvh - 224px); min-height: 480px; }
}

@media (max-width: 720px) {
  .app-width { width: min(100%, calc(100% - 12px)); }
  .topbar-inner { min-height: 54px; }
  .work-command-bar, .history-command-bar, .search-command-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
  }
  .work-command-search, .history-command-search, .search-command-bar .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }
  .work-status-inline, .history-status-inline {
    grid-column: 1 / -1;
    order: initial;
  }
  .compact-filter-select { grid-column: 1; }
  .work-command-meta { grid-column: 2; justify-content: flex-end; }
  .compact-filter-select select { width: 132px; }
  .search-command-bar select { min-width: 0; width: 100%; }
  .data-grid-scroll { height: auto; min-height: 0; max-height: none; }
}


/* =========================================================
   V7 — unified Orders workspace + customer intelligence
   ========================================================= */

.orders-workspace-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  font-size: 12px;
  font-weight: 900;
  color: #344054;
}

.auth-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
}

.remember-me-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.remember-me-control input {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.remember-device-note {
  color: #98a2b3;
  font-size: 10px;
}

.customer-intelligence-block {
  padding-top: 13px;
  padding-bottom: 13px;
}

.customer-intelligence-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.smart-badge {
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  padding: 3px 7px;
  background: #f8fafc;
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .08em;
}

.customer-history-loading,
.customer-history-empty {
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  color: #667085;
  font-size: 10px;
}

.customer-history-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid #d0d5dd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.customer-risk-card {
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.customer-risk-card[data-risk="low"] { border-color: #abefc6; background: #f6fef9; }
.customer-risk-card[data-risk="medium"] { border-color: #fedf89; background: #fffaeb; }
.customer-risk-card[data-risk="high"] { border-color: #fecdca; background: #fffbfa; }
.customer-risk-card[data-risk="new"] { border-color: #b2ddff; background: #f5faff; }

.customer-risk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.customer-risk-head > div {
  display: grid;
  gap: 3px;
}

.customer-type-label {
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .08em;
}

.customer-risk-head strong {
  color: #101828;
  font-size: 13px;
  line-height: 1.3;
}

.risk-level-badge {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: .05em;
}

.risk-level-badge[data-risk="low"] { background: #dcfae6; color: #067647; }
.risk-level-badge[data-risk="medium"] { background: #fef0c7; color: #b54708; }
.risk-level-badge[data-risk="high"] { background: #fee4e2; color: #b42318; }
.risk-level-badge[data-risk="new"] { background: #dbeeff; color: #175cd3; }

.customer-risk-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 11px;
}

.customer-risk-metrics > div {
  min-width: 0;
  border: 1px solid rgba(152,162,179,.25);
  border-radius: 9px;
  padding: 7px;
  background: rgba(255,255,255,.72);
}

.customer-risk-metrics strong,
.customer-risk-metrics span {
  display: block;
}

.customer-risk-metrics strong {
  color: #101828;
  font-size: 13px;
  font-weight: 900;
}

.customer-risk-metrics span {
  margin-top: 2px;
  color: #667085;
  font-size: 7px;
  line-height: 1.2;
}

.shared-number-warning {
  margin-top: 9px;
  border-radius: 9px;
  padding: 8px 9px;
  background: #fff4ed;
  color: #b93815;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.45;
}

.risk-recommendation {
  display: grid;
  gap: 3px;
  margin-top: 10px;
}

.risk-recommendation span {
  color: #667085;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.risk-recommendation strong {
  color: #344054;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.5;
}

.customer-status-history {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.history-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e4e7ec;
  border-radius: 999px;
  padding: 4px 7px;
  background: #fff;
  color: #475467;
  font-size: 8px;
  font-weight: 750;
}

.history-status-chip b {
  color: #101828;
}

.previous-orders-list {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.previous-orders-heading {
  color: #667085;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.previous-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f2f4f7;
  padding: 7px 1px;
}

.previous-order-row:last-child { border-bottom: 0; }
.previous-order-row > div { min-width: 0; display: grid; gap: 2px; }
.previous-order-row > div:last-child { justify-items: end; text-align: right; }
.previous-order-row strong { color: #344054; font-size: 9px; }
.previous-order-row span:not(.status-badge) { color: #667085; font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.previous-order-row small { color: #98a2b3; font-size: 7px; }
.compact-status { padding: 3px 6px; font-size: 7px; }

/* All status chips are visible; scroll horizontally rather than wrapping into many rows. */
.work-status-inline {
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.work-status-inline .filter-chip {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .orders-workspace-label { display: none; }
  .remember-device-note { display: none; }
  .customer-risk-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


.duplicate-order-warning,
.deposit-recommendation {
  margin-top: 9px;
  border-radius: 9px;
  padding: 8px 9px;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.45;
}

.duplicate-order-warning {
  background: #eef4ff;
  color: #3538cd;
}

.deposit-recommendation {
  background: #fee4e2;
  color: #b42318;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* V7.1 customer-history lifecycle refinements */
.customer-risk-card[data-risk="unverified"] {
  border-color: #d6bbfb;
  background: #fcfaff;
}

.risk-level-badge[data-risk="unverified"] {
  background: #f1e9ff;
  color: #6941c6;
}

.customer-risk-metrics-v2 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.unverified-history-warning,
.operations-history-note {
  margin-top: 9px;
  border-radius: 9px;
  padding: 8px 9px;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.45;
}

.unverified-history-warning {
  background: #f4f3ff;
  color: #5925dc;
}

.operations-history-note {
  background: #f8fafc;
  color: #475467;
  border: 1px solid #e4e7ec;
}

.previous-orders-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.previous-orders-heading span {
  color: #98a2b3;
  font-size: 7px;
  font-weight: 750;
  text-transform: none;
  letter-spacing: 0;
}

.previous-order-reason {
  color: #667085 !important;
  white-space: normal !important;
  max-width: 230px;
}

@media (max-width: 720px) {
  .customer-risk-metrics-v2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* V7.2 — legacy cancellation context */
.legacy-history-note {
  margin-top: 8px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 9px 10px;
  background: #f9fafb;
  color: #475467;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.45;
}

.legacy-history-note.legacy-caution {
  border-color: #fedf89;
  background: #fffaeb;
  color: #93370d;
}

.previous-order-reason.legacy-reason {
  color: #667085;
  font-style: italic;
}


/* =========================================================
   V7.3 — productivity sidebar + persistent pagination + contact actions
   ========================================================= */
:root {
  --sidebar-collapsed: 64px;
  --sidebar-expanded: 238px;
}

body {
  padding-left: var(--sidebar-collapsed);
  transition: padding-left .18s ease;
}

body.sidebar-expanded {
  padding-left: var(--sidebar-expanded);
}

.productivity-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 70;
  width: var(--sidebar-collapsed);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e4e7ec;
  background: var(--navy);
  color: #fff;
  overflow: hidden;
  transition: width .18s ease, transform .18s ease;
}

body.sidebar-expanded .productivity-sidebar {
  width: var(--sidebar-expanded);
}

.sidebar-brand-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar-brand-mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  background: #fff;
  color: var(--navy);
}

.sidebar-brand-copy {
  width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity .12s ease, width .18s ease;
}
body.sidebar-expanded .sidebar-brand-copy {
  width: 130px;
  opacity: 1;
}
.sidebar-brand-copy strong,
.sidebar-brand-copy span { display: block; }
.sidebar-brand-copy strong { font-size: 11px; font-weight: 900; }
.sidebar-brand-copy span { margin-top: 2px; color: #98a2b3; font-size: 8px; font-weight: 700; }

.sidebar-toggle {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 0;
  background: rgba(255,255,255,.06);
  color: #d0d5dd;
}
.sidebar-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
body:not(.sidebar-expanded) .sidebar-toggle { display: none; }

.sidebar-menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 7px 12px;
  scrollbar-width: thin;
}

.sidebar-section-label {
  height: 25px;
  display: flex;
  align-items: flex-end;
  padding: 0 7px 5px;
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
}
body.sidebar-expanded .sidebar-section-label { opacity: 1; }

.sidebar-item {
  position: relative;
  width: 100%;
  min-height: 39px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 5px;
  margin: 2px 0;
  border: 0;
  border-radius: 9px;
  padding: 0 5px;
  background: transparent;
  color: #98a2b3;
  text-align: left;
  overflow: hidden;
}
.sidebar-item:hover:not(:disabled) { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-item.active { background: rgba(255,255,255,.11); color: #fff; }
.sidebar-item svg {
  grid-column: 1;
  justify-self: center;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-item > span {
  grid-column: 2;
  min-width: 0;
  opacity: 0;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 800;
}
.sidebar-item small,
.sidebar-key {
  grid-column: 3;
  opacity: 0;
  color: #667085;
  font-size: 6px;
  font-weight: 900;
}
.sidebar-key { border: 1px solid rgba(255,255,255,.12); border-radius: 4px; padding: 1px 4px; }
body.sidebar-expanded .sidebar-item > span,
body.sidebar-expanded .sidebar-item small,
body.sidebar-expanded .sidebar-key { opacity: 1; }
.sidebar-item.future { opacity: .48; cursor: default; }

.sidebar-user-card {
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #344054;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}
.sidebar-user-copy {
  width: 0;
  opacity: 0;
  display: grid;
  gap: 1px;
  overflow: hidden;
  white-space: nowrap;
}
body.sidebar-expanded .sidebar-user-copy { width: 155px; opacity: 1; }
.sidebar-user-copy strong { overflow: hidden; text-overflow: ellipsis; font-size: 9px; color: #fff; }
.sidebar-user-copy span, .sidebar-user-copy small { overflow: hidden; text-overflow: ellipsis; color: #98a2b3; font-size: 7px; }

.sidebar-backdrop { display: none; }

.app-topbar { left: 0; }
.topbar-inner { justify-content: space-between; }
.topbar-page-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-page-title > div { display: flex; align-items: baseline; gap: 9px; }
.topbar-page-title strong { color: #101828; font-size: 14px; font-weight: 900; }
.topbar-page-title .business-date { margin: 0; }
.sidebar-mobile-toggle { display: grid; }
body.sidebar-expanded .sidebar-mobile-toggle { display: none; }

/* Customer contact actions stay near the phone/email details. */
.customer-contact-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.contact-action {
  min-width: 0;
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  padding: 7px;
  background: #fff;
  color: #344054;
  text-decoration: none;
}
.contact-action:hover { border-color: #b9c2d0; background: #f8fafc; }
.contact-action-icon {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 950;
}
.contact-action > span:last-child { min-width: 0; display: grid; gap: 2px; }
.contact-action strong { font-size: 8px; font-weight: 900; }
.contact-action small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #667085; font-size: 6.5px; }
.contact-call .contact-action-icon { background: #e8f1ff; color: #175cd3; }
.contact-whatsapp .contact-action-icon { background: #dcfae6; color: #067647; }
.contact-email .contact-action-icon { background: #f1e9ff; color: #6941c6; }
.contact-actions-empty { grid-column: 1 / -1; color: #98a2b3; font-size: 8px; }

/* Load-more remains visually anchored below the data grid. */
.load-more { scroll-margin-top: 72px; }

@media (min-width: 821px) {
  .app-width { width: min(1760px, calc(100% - 14px)); }
}

@media (max-width: 820px) {
  body, body.sidebar-expanded { padding-left: 0; }
  .productivity-sidebar {
    width: min(280px, 84vw);
    transform: translateX(-102%);
    box-shadow: 14px 0 32px rgba(16,24,40,.22);
  }
  body.sidebar-mobile-open .productivity-sidebar { transform: translateX(0); }
  body.sidebar-mobile-open .sidebar-brand-copy,
  body.sidebar-mobile-open .sidebar-user-copy { width: 155px; opacity: 1; }
  body.sidebar-mobile-open .sidebar-section-label,
  body.sidebar-mobile-open .sidebar-item > span,
  body.sidebar-mobile-open .sidebar-item small,
  body.sidebar-mobile-open .sidebar-key { opacity: 1; }
  body.sidebar-mobile-open .sidebar-toggle { display: grid; }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    display: block;
    background: rgba(16,24,40,.38);
    opacity: 0;
    transition: opacity .18s ease;
  }
  .sidebar-backdrop.open { opacity: 1; }
  .sidebar-mobile-toggle,
  body.sidebar-expanded .sidebar-mobile-toggle { display: grid; }
  .topbar-page-title > div { display: grid; gap: 0; }
  .topbar-page-title strong { font-size: 12px; }
  .customer-contact-actions { grid-template-columns: repeat(3, minmax(80px, 1fr)); overflow-x: auto; }
}


/* =========================================================
   V7.4 — Rexfair branding + intelligent phone/contact controls
   ========================================================= */

.phone-detail-row {
  align-items: start;
}

.phone-detail-value {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  text-align: right;
}

.phone-detail-value > strong {
  flex: 0 1 auto;
}

.phone-quality-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 7px !important;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.phone-quality-tag[data-phone-kind="valid"] {
  background: #dcfae6;
  color: #067647;
}
.phone-quality-tag[data-phone-kind="fixed"] {
  background: #e8f1ff;
  color: #175cd3;
}
.phone-quality-tag[data-phone-kind="foreign"],
.phone-quality-tag[data-phone-kind="possible-foreign"] {
  background: #efe8ff;
  color: #6941c6;
}
.phone-quality-tag[data-phone-kind="incomplete"],
.phone-quality-tag[data-phone-kind="too-long"] {
  background: #ffead5;
  color: #b54708;
}
.phone-quality-tag[data-phone-kind="invalid"] {
  background: #fee4e2;
  color: #b42318;
}

.phone-normalized,
.phone-quality-note {
  flex: 1 0 100%;
  color: #667085 !important;
  font-size: 7px !important;
  line-height: 1.35;
}

.phone-quality-note {
  color: #98a2b3 !important;
}

/* Solid contact buttons for quick recognition and larger click targets. */
.customer-contact-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-action {
  min-height: 44px;
  border: 0;
  color: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.10);
}
.contact-action:hover {
  border: 0;
  color: #fff;
  filter: brightness(.96);
}
.contact-action strong,
.contact-action small {
  color: #fff !important;
}
.contact-action small {
  opacity: .82;
}
.contact-action-icon {
  background: rgba(255,255,255,.17) !important;
  color: #fff !important;
}
.contact-call { background: #175cd3; }
.contact-whatsapp { background: #128c4e; }
.contact-email { background: #6941c6; }

.contact-actions-warning {
  grid-column: 1 / -1;
  border: 1px solid #fedf89;
  border-radius: 9px;
  padding: 7px 9px;
  background: #fffaeb;
  color: #93370d;
  font-size: 8px;
  font-weight: 750;
  line-height: 1.4;
}

.previous-order-customer {
  color: #344054 !important;
  font-weight: 800;
}

@media (max-width: 720px) {
  .customer-contact-actions {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    overflow-x: visible;
  }

  .phone-detail-value {
    justify-content: flex-end;
  }
}


/* =========================================================
   V7.5 — accurate reschedule shortcut + richer drawer/stats
   ========================================================= */

/* Contact actions must remain solid on hover. Earlier generic hover rules
   used a light background, so explicitly preserve each action family. */
.contact-call:hover,
.contact-call:focus-visible {
  background: #134ea8;
  color: #fff;
}
.contact-whatsapp:hover,
.contact-whatsapp:focus-visible {
  background: #0f7a43;
  color: #fff;
}
.contact-email:hover,
.contact-email:focus-visible {
  background: #5837ad;
  color: #fff;
}
.contact-action:hover .contact-action-icon,
.contact-action:focus-visible .contact-action-icon {
  background: rgba(255,255,255,.22) !important;
  color: #fff !important;
}

/* Order ID + customer name share the same heading weight/size. */
.drawer-header h2 {
  max-width: 360px;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

/* Visible only while the special Rescheduled for Today view is active. */
.quick-filter-chip {
  flex: 0 0 auto;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #fed7aa;
  border-radius: 9px;
  padding: 5px 8px;
  background: #ffead5;
  color: #b54708;
  font-size: 8px;
  font-weight: 850;
  white-space: nowrap;
}
.quick-filter-chip:hover {
  background: #ffdfbf;
}
.quick-filter-chip b {
  font-size: 13px;
  line-height: 1;
}

/* Summary cards use the same soft visual language as status pills. */
.summary-card.neutral {
  background: #f8fafc;
  border-color: #e4e7ec;
}
.summary-card.pending {
  background: #fff4cc;
  border-color: #f6d96b;
}
.summary-card.followup {
  background: #e8f1ff;
  border-color: #c9dcff;
}
.summary-card.confirmed {
  background: #e8f8f3;
  border-color: #c4eddf;
}
.summary-card.transit {
  background: #efe8ff;
  border-color: #d9ceff;
}
.summary-card.delivered {
  background: #dcfae6;
  border-color: #b9efca;
}
.summary-card.rescheduled {
  background: #ffead5;
  border-color: #ffd1a4;
}
.summary-card.cancelled {
  background: #fee4e2;
  border-color: #fecdca;
}
.summary-card.failed {
  background: #ffe4e8;
  border-color: #fecdd6;
}

/* Remove old top-border-only emphasis so the soft background is the cue. */
.summary-card.pending,
.summary-card.due,
.summary-card.exception,
.summary-card.confirmed,
.summary-card.transit {
  border-top-width: 1px;
}

.summary-card.pending .summary-label,
.summary-card.pending .summary-rate { color: #8a5b00; }
.summary-card.followup .summary-label,
.summary-card.followup .summary-rate { color: #175cd3; }
.summary-card.confirmed .summary-label,
.summary-card.confirmed .summary-rate { color: #087a5b; }
.summary-card.transit .summary-label,
.summary-card.transit .summary-rate { color: #6941c6; }
.summary-card.delivered .summary-label,
.summary-card.delivered .summary-rate { color: #067647; }
.summary-card.rescheduled .summary-label,
.summary-card.rescheduled .summary-rate { color: #b54708; }
.summary-card.cancelled .summary-label,
.summary-card.cancelled .summary-rate { color: #b42318; }
.summary-card.failed .summary-label,
.summary-card.failed .summary-rate { color: #c01048; }

@media (max-width: 820px) {
  .quick-filter-chip {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .drawer-header h2 {
    max-width: calc(100vw - 90px);
  }
}


/* =========================================================
   V7.6 — Rescheduled Due operational backlog
   ========================================================= */
.reschedule-due-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 3px;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 7px;
  line-height: 1.2;
  font-weight: 900;
  white-space: nowrap;
}
.reschedule-due-badge.due-today {
  background: #ffead5;
  color: #b54708;
  border: 1px solid #fed7aa;
}
.reschedule-due-badge.overdue-reschedule {
  background: #fee4e2;
  color: #b42318;
  border: 1px solid #fecdca;
}

/* Let the special filter describe itself without consuming another row. */
.quick-filter-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-filter-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fee4e2;
  color: #b42318;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}
body:not(.sidebar-expanded) .sidebar-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  font-size: 7px;
}

/* =========================================================
   V7.9 — Sales Tools / Invoice workspace
   ========================================================= */

.topbar-new-order {
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid #0B1F3B;
  border-radius: 10px;
  background: #0B1F3B;
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 31, 59, .16);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.topbar-new-order:hover,
.topbar-new-order:focus-visible {
  background: #16345F;
  border-color: #16345F;
  color: #fff;
  transform: translateY(-1px);
}

.sidebar-item[data-sidebar-action="invoice"] svg,
.sidebar-item[data-sidebar-action="new-order"] svg {
  stroke: currentColor;
}

.sidebar-item[data-sidebar-action="invoice"].active,
.sidebar-item[data-sidebar-action="new-order"].active {
  background: #fff4e8;
  color: #8f4f1f;
}

.invoice-workspace,
.planned-tool-workspace {
  padding: 2px 0 22px;
}

.module-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 12px;
}

.module-page-head h1,
.planned-tool-card h1 {
  margin: 3px 0 4px;
  color: #0b1f3b;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.module-page-head p,
.planned-tool-card p {
  max-width: 820px;
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.65;
}

.invoice-search-card,
.invoice-results-card,
.invoice-preview-card {
  margin-bottom: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(11, 31, 59, .04);
}

.invoice-search-card,
.invoice-results-card {
  padding: 14px;
}

.invoice-preview-card {
  overflow: hidden;
}

.invoice-preview-card > .invoice-card-heading {
  padding: 14px 14px 0;
}

.invoice-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.invoice-card-heading h2 {
  margin: 0 0 3px;
  color: #0b1f3b;
  font-size: 15px;
  font-weight: 900;
}

.invoice-card-heading p {
  margin: 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.5;
}

.invoice-search-grid {
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(280px, 2fr) auto;
  align-items: end;
  gap: 9px;
}

.invoice-field {
  display: grid;
  gap: 5px;
}

.invoice-field > span {
  color: #475467;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.invoice-field input,
.invoice-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
  color: #101828;
  font: inherit;
  font-size: 11px;
  outline: none;
}

.invoice-field input:focus,
.invoice-field select:focus {
  border-color: #7a91ae;
  box-shadow: 0 0 0 3px rgba(11, 31, 59, .08);
}

.invoice-search-buttons,
.invoice-result-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.invoice-search-hints {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.invoice-search-hints span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f5f8fc;
  color: #52657d;
  font-size: 8px;
  font-weight: 800;
}

.invoice-result-list {
  display: grid;
  gap: 7px;
  max-height: 390px;
  overflow: auto;
  padding-right: 2px;
}

.invoice-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 9px 10px;
  border: 1px solid #e4e7ec;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

.invoice-result-row:hover {
  border-color: #c3cedb;
  background: #fbfcfe;
}

.invoice-result-row:has(input:checked) {
  border-color: #8fa3bd;
  box-shadow: inset 3px 0 0 #0b1f3b;
  background: #f8fbff;
}

.invoice-result-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0b1f3b;
}

.invoice-result-main {
  min-width: 0;
}

.invoice-result-ref-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.invoice-result-ref-line > strong {
  color: #0b1f3b;
  font-size: 11px;
}

.invoice-result-ref-line > span {
  color: #8f4f1f;
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.invoice-result-customer {
  margin-top: 3px;
  color: #344054;
  font-size: 10px;
  font-weight: 800;
}

.invoice-result-products {
  margin-top: 2px;
  overflow: hidden;
  color: #667085;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-result-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: #98a2b3;
  font-size: 8px;
}

.invoice-result-total {
  display: grid;
  justify-items: end;
  gap: 3px;
  white-space: nowrap;
}

.invoice-result-total strong {
  color: #0b1f3b;
  font-size: 11px;
}

.invoice-result-total span {
  color: #98a2b3;
  font-size: 8px;
}

.invoice-preview-empty {
  min-height: 260px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  color: #98a2b3;
  text-align: center;
}

.invoice-preview-empty strong {
  color: #344054;
  font-size: 13px;
}

.invoice-preview-empty span {
  font-size: 10px;
}

.invoice-empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f2f4f7;
  color: #667085;
  font-size: 20px;
}

.invoice-preview-ready {
  padding: 10px 14px 16px;
  overflow: auto;
  background: #f5f7fa;
}

.invoice-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding: 7px 0;
}

.invoice-preview-toolbar > div:first-child {
  display: grid;
  gap: 1px;
}

.invoice-preview-toolbar strong {
  color: #0b1f3b;
  font-size: 11px;
}

.invoice-preview-toolbar span {
  color: #667085;
  font-size: 8px;
}

.invoice-preview-toolbar > div:last-child {
  display: flex;
  gap: 7px;
}

.invoice-document {
  width: min(100%, 1080px);
  min-width: 850px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #dfe5ec;
  border-radius: 14px;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 14px 38px rgba(11, 31, 59, .08);
}

.invoice-accent-bar {
  height: 6px;
  background: linear-gradient(90deg, #0b1f3b 0%, #16345f 72%, #b87333 72%, #b87333 100%);
}

.invoice-document-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, .8fr);
  gap: 24px;
  padding: 28px 30px 22px;
  border-bottom: 1px solid #edf0f3;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}

.invoice-brand-block {
  min-width: 0;
}

.invoice-doc-kicker,
.invoice-info-title {
  display: block;
  color: #8f4f1f;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.invoice-brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.invoice-brand-line img {
  width: 72px;
  height: 42px;
  object-fit: contain;
}

.invoice-brand-line strong,
.invoice-brand-text {
  margin-top: 8px;
  color: #0b1f3b;
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -.04em;
}

.invoice-brand-block > p {
  max-width: 540px;
  margin: 9px 0 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.6;
}

.invoice-brand-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.invoice-brand-contacts span {
  padding: 4px 7px;
  border: 1px solid #dbe6f2;
  border-radius: 999px;
  background: #f5f9fd;
  color: #35506d;
  font-size: 8px;
  font-weight: 800;
}

.invoice-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.invoice-reference-grid > div {
  padding: 9px 10px;
  border: 1px solid #e0e6ed;
  border-radius: 9px;
  background: #fff;
}

.invoice-reference-grid span {
  display: block;
  margin-bottom: 3px;
  color: #98a2b3;
  font-size: 7px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.invoice-reference-grid strong {
  color: #0b1f3b;
  font-size: 10px;
  line-height: 1.35;
}

.invoice-source-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 30px;
  background: #fff7ee;
  color: #8f4f1f;
  font-size: 8px;
}

.invoice-source-strip strong {
  color: #74401b;
  text-align: right;
}

.invoice-two-column,
.invoice-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 30px 0;
}

.invoice-info-box,
.invoice-bank-box {
  padding: 13px 14px;
  border: 1px solid #e2e8ef;
  border-radius: 10px;
  background: #fbfcfd;
}

.invoice-info-box .invoice-info-title,
.invoice-bank-box .invoice-info-title {
  margin-bottom: 8px;
}

.invoice-customer-name {
  display: block;
  margin-bottom: 5px;
  color: #101828;
  font-size: 13px;
}

.invoice-info-box p,
.invoice-bank-box p {
  margin: 4px 0 0;
  color: #475467;
  font-size: 9px;
  line-height: 1.5;
}

.invoice-info-box p b,
.invoice-bank-box p b {
  color: #344054;
}

.invoice-items-box {
  margin: 12px 30px 0;
  overflow: hidden;
  border: 1px solid #dde5ed;
  border-radius: 11px;
}

.invoice-items-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f5f8fb;
}

.invoice-items-heading strong {
  color: #0b1f3b;
  font-size: 11px;
}

.invoice-items-heading span {
  color: #667085;
  font-size: 8px;
  font-weight: 800;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-items-table th {
  padding: 8px 10px;
  border-top: 1px solid #e4eaf0;
  border-bottom: 1px solid #e4eaf0;
  background: #fbfcfd;
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.invoice-items-table th:not(:first-child),
.invoice-items-table td:not(:first-child) {
  text-align: right;
}

.invoice-items-table td {
  padding: 10px;
  border-bottom: 1px solid #eef1f4;
  color: #344054;
  font-size: 9px;
  vertical-align: top;
}

.invoice-items-table td strong {
  display: block;
  color: #101828;
  font-size: 9px;
}

.invoice-items-table td small {
  display: block;
  margin-top: 3px;
  color: #98a2b3;
  font-size: 7px;
}

.invoice-line-total {
  color: #0b1f3b !important;
  font-weight: 900;
}

.invoice-bottom-grid {
  padding-bottom: 20px;
}

.invoice-bottom-no-bank {
  grid-template-columns: minmax(320px, .45fr);
  justify-content: end;
}

.invoice-bank-box {
  background: #f4f8fd;
  border-color: #d9e5f1;
}

.invoice-total-box {
  overflow: hidden;
  border: 1px solid #dde5ed;
  border-radius: 10px;
}

.invoice-total-box > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid #edf1f4;
  color: #475467;
  font-size: 9px;
}

.invoice-total-box > div strong {
  color: #101828;
}

.invoice-total-box .invoice-grand-total {
  border-bottom: 0;
  background: #eaf1f9;
  color: #0b1f3b;
  font-size: 12px;
  font-weight: 900;
}

.invoice-total-box .invoice-grand-total strong {
  color: #0b1f3b;
}

.invoice-footer-note {
  margin: 0 30px;
  padding: 14px 0 20px;
  border-top: 1px solid #eef1f4;
  color: #667085;
  font-size: 8px;
  line-height: 1.6;
  text-align: center;
}

.planned-tool-workspace {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.planned-tool-workspace[hidden] {
  display: none;
}

.planned-tool-card {
  width: min(620px, 100%);
  padding: 34px;
  border: 1px solid #e4e7ec;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(11, 31, 59, .06);
  text-align: center;
}

.planned-tool-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 15px;
  background: #fff1e3;
  color: #9a5926;
  font-size: 28px;
  font-weight: 700;
}

.planned-tool-card p {
  margin-inline: auto;
}

.planned-tool-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 820px) {
  .topbar-new-order {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 9px;
  }

  .invoice-search-grid {
    grid-template-columns: 1fr 1.4fr;
  }

  .invoice-search-buttons {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .module-page-head {
    align-items: center;
  }

  .invoice-document {
    min-width: 760px;
  }
}

@media (max-width: 560px) {
  .topbar-new-order {
    padding-inline: 8px;
  }

  .topbar-new-order span + * {
    display: none;
  }

  .module-page-head {
    display: grid;
  }

  .module-page-head .button {
    justify-self: start;
  }

  .invoice-search-grid {
    grid-template-columns: 1fr;
  }

  .invoice-search-buttons {
    grid-column: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .invoice-results-heading {
    display: grid;
  }

  .invoice-result-actions {
    width: 100%;
  }

  .invoice-result-actions .button {
    flex: 1;
  }

  .invoice-result-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .invoice-result-total {
    grid-column: 2;
    justify-items: start;
  }

  .invoice-preview-toolbar {
    align-items: flex-start;
  }

  .invoice-preview-toolbar > div:last-child {
    flex-direction: column;
  }

  .planned-tool-card {
    padding: 24px 18px;
  }

  .planned-tool-actions {
    display: grid;
  }
}


/* =========================================================
   V8 — crisp lightweight A4 invoice
   ========================================================= */
.invoice-search-grid-v8 {
  grid-template-columns: minmax(150px,.75fr) minmax(260px,1.5fr) minmax(190px,.8fr) auto;
  align-items: end;
}
.invoice-date-field small {
  display: block;
  margin-top: 4px;
  color: #98a2b3;
  font-size: 8px;
  line-height: 1.35;
}
.invoice-date-field input:disabled {
  background: #f8fafc;
  color: #98a2b3;
}
.invoice-preview-ready {
  background: #eef2f6;
}
.invoice-document {
  box-sizing: border-box;
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: 0 4px 18px rgba(11,31,59,.08);
  background: #fff;
  color: #1f2937;
  display: flex;
  flex-direction: column;
}
.invoice-accent-bar {
  height: 5px;
  background: #0b1f3b;
}
.invoice-document-header {
  grid-template-columns: minmax(0,1.45fr) minmax(280px,.75fr);
  gap: 22px;
  padding: 28px 32px 20px;
  background: #fff;
  border-bottom-color: #e6ebf0;
}
.invoice-doc-kicker,
.invoice-info-title {
  color: #234a7a;
}
.invoice-brand-line {
  margin-top: 10px;
}
.invoice-brand-logo-only img {
  width: auto;
  max-width: 190px;
  height: 58px;
  max-height: 58px;
  object-fit: contain;
  object-position: left center;
  display: block;
}
.invoice-brand-text {
  margin-top: 9px;
  color: #0b1f3b;
  font-size: 30px;
  font-weight: 950;
  letter-spacing: -.04em;
}
.invoice-reference-grid {
  grid-template-columns: repeat(2,minmax(0,1fr));
  align-content: start;
}
.invoice-reference-grid .invoice-generated-by {
  grid-column: 1 / -1;
}
.invoice-reference-grid > div,
.invoice-info-box,
.invoice-bank-box,
.invoice-total-box,
.invoice-items-box {
  border-radius: 6px;
}
.invoice-reference-grid > div {
  background: #f8fafc;
}
.invoice-source-strip {
  background: #f2f6fb;
  color: #35506d;
}
.invoice-source-strip strong {
  color: #0b1f3b;
}
.invoice-info-box,
.invoice-bank-box {
  background: #fbfcfe;
}
.invoice-bank-box {
  background: #f3f7fb;
  border-color: #d9e5f1;
}
.invoice-items-heading {
  background: #f3f7fb;
}
.invoice-items-table th {
  background: #f8fafc;
}
.invoice-total-box .invoice-grand-total {
  background: #eaf1f9;
}
.invoice-footer-note {
  margin-top: auto;
}

@media (max-width: 1100px) {
  .invoice-search-grid-v8 {
    grid-template-columns: 1fr 1.4fr 1fr;
  }
  .invoice-search-grid-v8 .invoice-search-buttons {
    grid-column: 1 / -1;
  }
}
@media (max-width: 820px) {
  .invoice-search-grid-v8 {
    grid-template-columns: 1fr 1fr;
  }
  .invoice-search-grid-v8 .invoice-date-field {
    grid-column: 1;
  }
  .invoice-search-grid-v8 .invoice-search-buttons {
    grid-column: 2;
    align-self: end;
  }
}
@media (max-width: 560px) {
  .invoice-search-grid-v8 {
    grid-template-columns: 1fr;
  }
  .invoice-search-grid-v8 .invoice-date-field,
  .invoice-search-grid-v8 .invoice-search-buttons {
    grid-column: auto;
  }
}

/* Remove copper/brown from the invoice tool itself. */
.sidebar-item[data-sidebar-action="invoice"].active {
  background: #edf4fb;
  color: #16345f;
}
.invoice-result-ref-line > span {
  color: #234a7a;
}


/* V8.1 — trace source order on combined invoice line items */
.invoice-item-order-ref {
  display: inline;
  margin-left: 5px;
  color: #667085;
  font-size: 0.82em;
  font-weight: 700;
  white-space: nowrap;
}


/* =========================================================
   V8.3 — multi exact Order IDs + aligned invoice controls
   ========================================================= */
.invoice-search-grid-v8 {
  align-items: start;
}

.invoice-search-value-field textarea {
  width: 100%;
  height: 38px;
  min-height: 38px;
  max-height: 110px;
  resize: vertical;
  overflow-y: auto;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
  color: #101828;
  font: inherit;
  font-size: 11px;
  line-height: 20px;
  outline: none;
}

.invoice-search-value-field textarea:focus {
  border-color: #7a91ae;
  box-shadow: 0 0 0 3px rgba(11, 31, 59, .08);
}

.invoice-search-grid-v8 .invoice-search-buttons {
  align-self: start;
  padding-top: 19px;
}

.invoice-search-grid-v8 .invoice-date-field,
.invoice-search-grid-v8 .invoice-search-value-field,
.invoice-search-grid-v8 > .invoice-field {
  align-self: start;
}

@media (max-width: 1100px) {
  .invoice-search-grid-v8 .invoice-search-buttons {
    padding-top: 0;
  }
}

@media (max-width: 820px) {
  .invoice-search-grid-v8 .invoice-search-buttons {
    padding-top: 19px;
  }
}

@media (max-width: 560px) {
  .invoice-search-grid-v8 .invoice-search-buttons {
    padding-top: 0;
  }
}


/* =========================================================
   V8.4 — simple Paid-only receipt module
   ========================================================= */
.receipt-search-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
}
.receipt-order-id-field { max-width: 620px; }
.receipt-search-actions { display: flex; gap: 8px; align-items: center; }
.receipt-result-mount { padding: 0 18px 18px; }
.receipt-order-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
}
.receipt-payment-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.receipt-payment-badge.paid { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.receipt-payment-badge.unpaid { background: #fff7ed; color: #b54708; border: 1px solid #fed7aa; }
.receipt-paid-warning { margin-top: 12px; }
.receipt-payment-box { position: relative; overflow: hidden; }
.receipt-paid-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0 10px;
  padding: 6px 14px;
  border: 2px solid #067647;
  border-radius: 6px;
  color: #067647;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .12em;
}
.receipt-total-section { justify-items: end; }
.receipt-total-section .invoice-total-box { width: min(100%, 420px); }
.receipt-document .invoice-doc-kicker { color: #0B1F3B; }

@media (max-width: 700px) {
  .receipt-search-row { grid-template-columns: 1fr; align-items: stretch; }
  .receipt-order-id-field { max-width: none; }
  .receipt-search-actions { justify-content: stretch; }
  .receipt-search-actions .button { flex: 1; }
  .receipt-order-result { grid-template-columns: 1fr; align-items: start; }
}


/* =========================================================
   V8.5 — combined paid receipts
   ========================================================= */
.receipt-order-id-field textarea {
  width: 100%;
  min-height: 62px;
  max-height: 130px;
  resize: vertical;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  padding: 9px 10px;
  background: #fff;
  color: #101828;
  font: inherit;
  font-size: 11px;
  line-height: 20px;
  outline: none;
}

.receipt-order-id-field textarea:focus {
  border-color: #7a91ae;
  box-shadow: 0 0 0 3px rgba(11, 31, 59, .08);
}

.receipt-results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  color: #475467;
  font-size: 12px;
}

.receipt-results-summary strong { color: #0b1f3b; }
.receipt-result-list { display: grid; gap: 8px; }
.receipt-result-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.receipt-result-row-unpaid { opacity: .72; }
.receipt-result-row-unpaid input[type="checkbox"] { accent-color: #98a2b3; }
.receipt-order-refs { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .receipt-results-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .receipt-result-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .receipt-result-row .invoice-result-total {
    grid-column: 2;
    text-align: left;
  }
}

/* V8.6 — receipt customer address */
.receipt-customer-address {
  margin-top: 6px;
  line-height: 1.55;
  color: #344054;
}

/* =========================================================
   V8.7 — unmistakable receipt document identity
   Same Rexfair palette, deliberately different from Invoice
   ========================================================= */
.receipt-document-v87 {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  color: #1f2937;
}

.receipt-document-v87 .receipt-brand-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 24px 30px 18px;
  border-bottom: 1px solid #e6ebf0;
  background: #ffffff;
}

.receipt-brand-identity {
  min-width: 0;
}

.receipt-brand-identity .invoice-brand-line,
.receipt-brand-identity .invoice-brand-text {
  margin-top: 0;
}

.receipt-brand-identity .invoice-brand-logo-only img {
  max-width: 180px;
  height: 52px;
  max-height: 52px;
}

.receipt-brand-identity .invoice-brand-text {
  font-size: 27px;
}

.receipt-brand-identity > p {
  max-width: 360px;
  margin: 8px 0 0;
  color: #667085;
  font-size: 8.5px;
  line-height: 1.55;
}

.receipt-brand-contacts {
  display: grid;
  justify-items: end;
  gap: 4px;
  padding-top: 2px;
  color: #475467;
  font-size: 8px;
  line-height: 1.45;
  text-align: right;
}

.receipt-hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(245px, .65fr);
  align-items: stretch;
  background: #0b1f3b;
  color: #ffffff;
}

.receipt-hero-copy {
  padding: 28px 30px 30px;
}

.receipt-hero-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #d7e5f3;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: .16em;
}

.receipt-hero-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -.045em;
}

.receipt-hero-copy p {
  margin: 10px 0 0;
  color: #dbe6f1;
  font-size: 9px;
}

.receipt-hero-meta {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 12px;
  padding: 22px 30px;
  border-left: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.035);
}

.receipt-hero-meta > div {
  display: grid;
  gap: 3px;
}

.receipt-hero-meta span {
  color: #b9cce0;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.receipt-hero-meta strong {
  color: #ffffff;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.receipt-payment-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin: 22px 30px 0;
  padding: 16px 18px;
  border: 1px solid #d8e4f0;
  border-radius: 8px;
  background: #f4f8fc;
}

.receipt-paid-mark {
  display: flex;
  align-items: center;
  gap: 11px;
}

.receipt-paid-check {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0b1f3b;
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
}

.receipt-paid-mark small,
.receipt-amount-received > span {
  display: block;
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.receipt-paid-mark strong {
  display: block;
  margin-top: 3px;
  color: #0b1f3b;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: .03em;
}

.receipt-amount-received {
  min-width: 180px;
  text-align: right;
}

.receipt-amount-received strong {
  display: block;
  margin-top: 4px;
  color: #0b1f3b;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.025em;
}

.receipt-details-grid {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr);
  gap: 14px;
  padding: 18px 30px 0;
}

.receipt-detail-card {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid #e1e7ee;
  border-radius: 8px;
  background: #ffffff;
}

.receipt-from-card {
  border-left: 4px solid #0b1f3b;
}

.receipt-order-card {
  background: #f8fafc;
}

.receipt-section-label {
  display: block;
  margin-bottom: 7px;
  color: #234a7a;
  font-size: 7px;
  font-weight: 950;
  letter-spacing: .12em;
}

.receipt-customer-name {
  display: block;
  margin-bottom: 8px;
  color: #101828;
  font-size: 13px;
  font-weight: 950;
}

.receipt-detail-card p {
  margin: 4px 0 0;
  color: #475467;
  font-size: 8px;
  line-height: 1.55;
}

.receipt-detail-pair {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px solid #e8edf2;
}

.receipt-detail-pair:first-of-type {
  padding-top: 2px;
}

.receipt-detail-pair:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.receipt-detail-pair span {
  color: #667085;
  font-size: 7px;
  font-weight: 800;
}

.receipt-detail-pair strong {
  color: #101828;
  font-size: 9px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.receipt-items-section {
  margin: 18px 30px 0;
  overflow: hidden;
  border: 1px solid #dfe6ed;
  border-radius: 8px;
}

.receipt-items-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #edf3f9;
}

.receipt-items-title-row .receipt-section-label {
  margin-bottom: 3px;
}

.receipt-items-title-row strong {
  color: #0b1f3b;
  font-size: 11px;
  font-weight: 950;
}

.receipt-items-title-row > span {
  color: #667085;
  font-size: 7.5px;
  font-weight: 800;
}

.receipt-items-table th {
  background: #f8fafc;
  color: #475467;
}

.receipt-items-table td strong {
  color: #0b1f3b;
}

.receipt-totals-wrap {
  display: flex;
  justify-content: flex-end;
  padding: 18px 30px 0;
}

.receipt-totals-card {
  width: min(100%, 390px);
  overflow: hidden;
  border: 1px solid #dfe6ed;
  border-radius: 8px;
  background: #ffffff;
}

.receipt-totals-card > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 12px;
  border-bottom: 1px solid #edf1f4;
  color: #475467;
  font-size: 8.5px;
}

.receipt-totals-card > div:last-child {
  border-bottom: 0;
}

.receipt-totals-card strong {
  color: #101828;
}

.receipt-totals-card .receipt-total-paid {
  padding: 13px 12px;
  background: #0b1f3b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .04em;
}

.receipt-totals-card .receipt-total-paid strong {
  color: #ffffff;
  font-size: 15px;
}

.receipt-document-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin: auto 30px 0;
  padding: 18px 0 22px;
  border-top: 1px solid #e7ecf1;
  color: #667085;
  font-size: 8px;
}

.receipt-document-footer > strong {
  color: #0b1f3b;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: .08em;
}

.receipt-document-footer > span {
  text-align: right;
}

/* Receipt uses navy payment confirmation, not the green stamp used in V8.4. */
.receipt-document-v87 .receipt-paid-stamp {
  border-color: #0b1f3b;
  color: #0b1f3b;
}

@media print {
  .receipt-document-v87 {
    box-shadow: none;
  }
}


/* =========================================================
   V8.8 — global-standard receipt hierarchy
   Same Rexfair brand header placement as invoice, clearly
   different receipt body, no promotional/explanatory copy.
   ========================================================= */
.receipt-document-v88 {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 297mm;
  overflow: hidden;
  background: #ffffff;
  color: #1f2937;
}

.receipt-document-v88 .receipt-accent-bar {
  height: 6px;
  flex: 0 0 auto;
  background: #0b1f3b;
}

.receipt-document-header {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr);
  gap: 24px;
  padding: 26px 30px 20px;
  border-bottom: 1px solid #e9edf2;
  background: #ffffff;
}

.receipt-brand-block {
  min-width: 0;
}

.receipt-brand-block .invoice-brand-line,
.receipt-brand-block .invoice-brand-text {
  margin-top: 0;
}

.receipt-brand-block .invoice-brand-logo-only img {
  max-width: 180px;
  height: 52px;
  max-height: 52px;
}

.receipt-brand-block .invoice-brand-text {
  color: #0b1f3b;
  font-size: 27px;
  font-weight: 950;
}

.receipt-brand-block > p {
  max-width: 520px;
  margin: 8px 0 0;
  color: #667085;
  font-size: 8.5px;
  line-height: 1.55;
}

.receipt-brand-contacts-v88 {
  margin-top: 9px;
}

.receipt-brand-contacts-v88 span {
  border-color: #dce6f0;
  background: #f6f9fc;
  color: #35506d;
}

.receipt-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-self: start;
}

.receipt-reference-grid > div {
  padding: 9px 10px;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  background: #ffffff;
}

.receipt-reference-grid span {
  display: block;
  margin-bottom: 3px;
  color: #98a2b3;
  font-size: 7px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.receipt-reference-grid strong {
  display: block;
  color: #0b1f3b;
  font-size: 9px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.receipt-reference-grid .receipt-generated-by {
  grid-column: 1 / -1;
}

.receipt-title-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 30px 16px;
}

.receipt-title-kicker {
  display: block;
  margin-bottom: 5px;
  color: #667085;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: .14em;
}

.receipt-title-section h1 {
  margin: 0;
  color: #0b1f3b;
  font-size: 42px;
  line-height: .95;
  font-weight: 950;
  letter-spacing: -.045em;
}

.receipt-paid-pill {
  min-width: 118px;
  padding: 9px 14px;
  border: 1px solid #cbd9e7;
  border-radius: 999px;
  background: #f4f8fc;
  text-align: center;
}

.receipt-paid-pill span {
  display: block;
  color: #667085;
  font-size: 6.5px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.receipt-paid-pill strong {
  display: block;
  margin-top: 2px;
  color: #0b1f3b;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .06em;
}

.receipt-amount-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 30px;
  padding: 16px 18px;
  border-radius: 10px;
  background: #0b1f3b;
  color: #ffffff;
}

.receipt-amount-panel > div > span {
  display: block;
  margin-bottom: 3px;
  color: #c5d6e7;
  font-size: 7px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.receipt-amount-panel > div > strong {
  display: block;
  color: #ffffff;
  font-size: 23px;
  font-weight: 950;
  letter-spacing: -.025em;
}

.receipt-order-reference {
  max-width: 44%;
  color: #e4edf5;
  font-size: 8px;
  font-weight: 750;
  line-height: 1.45;
  text-align: right;
  overflow-wrap: anywhere;
}

.receipt-details-grid-v88 {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 14px;
  padding: 18px 30px 0;
}

.receipt-detail-card-v88 {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid #e1e7ee;
  border-radius: 8px;
  background: #ffffff;
}

.receipt-reference-card-v88 {
  background: #f8fafc;
}

.receipt-section-label-v88 {
  display: block;
  margin-bottom: 8px;
  color: #667085;
  font-size: 7px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.receipt-customer-name-v88 {
  display: block;
  margin-bottom: 8px;
  color: #101828;
  font-size: 13px;
  font-weight: 950;
}

.receipt-detail-card-v88 p {
  margin: 4px 0 0;
  color: #475467;
  font-size: 8px;
  line-height: 1.55;
}

.receipt-reference-row-v88 {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e6ebf0;
}

.receipt-reference-row-v88:last-child {
  border-bottom: 0;
}

.receipt-reference-row-v88 span {
  color: #667085;
  font-size: 7.5px;
  font-weight: 800;
}

.receipt-reference-row-v88 strong {
  color: #101828;
  font-size: 8.5px;
  font-weight: 850;
  line-height: 1.4;
  text-align: right;
  overflow-wrap: anywhere;
}

.receipt-items-section-v88 {
  margin: 18px 30px 0;
  overflow: hidden;
  border: 1px solid #dfe6ed;
  border-radius: 8px;
}

.receipt-section-heading-v88 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: #f4f7fa;
  border-bottom: 1px solid #e4e9ef;
}

.receipt-section-heading-v88 strong {
  color: #0b1f3b;
  font-size: 10.5px;
  font-weight: 950;
}

.receipt-section-heading-v88 span {
  color: #667085;
  font-size: 7.5px;
  font-weight: 750;
}

.receipt-items-table-v88 th {
  background: #ffffff;
  color: #667085;
}

.receipt-items-table-v88 td strong {
  color: #101828;
}

.receipt-totals-wrap-v88 {
  display: flex;
  justify-content: flex-end;
  padding: 18px 30px 0;
}

.receipt-totals-card-v88 {
  width: min(100%, 390px);
  overflow: hidden;
  border: 1px solid #dfe6ed;
  border-radius: 8px;
  background: #ffffff;
}

.receipt-totals-card-v88 > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 12px;
  border-bottom: 1px solid #edf1f4;
  color: #475467;
  font-size: 8.5px;
}

.receipt-totals-card-v88 > div:last-child {
  border-bottom: 0;
}

.receipt-totals-card-v88 strong {
  color: #101828;
}

.receipt-totals-card-v88 .receipt-total-paid-v88 {
  padding: 13px 12px;
  background: #edf3f9;
  color: #0b1f3b;
  font-size: 11px;
  font-weight: 950;
}

.receipt-totals-card-v88 .receipt-total-paid-v88 strong {
  color: #0b1f3b;
  font-size: 15px;
}

.receipt-footer-v88 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: auto 30px 0;
  padding: 18px 0 22px;
  border-top: 1px solid #e7ecf1;
  color: #667085;
  font-size: 8px;
}

.receipt-footer-v88 strong {
  color: #98a2b3;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .05em;
  overflow-wrap: anywhere;
  text-align: right;
}

@media print {
  .receipt-document-v88 {
    box-shadow: none;
  }
}


/* =========================================================
   V8.9 — receipt clarity refinements
   - Source Order IDs appear only on item rows.
   - PAID is styled as a green approval stamp.
   - Redundant brand kicker above RECEIPT removed.
   ========================================================= */
.receipt-document-v88 .receipt-title-section {
  align-items: center;
}

.receipt-document-v88 .receipt-title-section h1 {
  font-size: 44px;
}

.receipt-document-v88 .receipt-paid-pill {
  position: relative;
  min-width: 116px;
  padding: 9px 16px 10px;
  border: 2px solid #12b76a;
  border-radius: 9px;
  outline: 1px dashed #75e0a7;
  outline-offset: -5px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(6, 118, 71, .04);
  color: #067647;
  transform: rotate(-4deg);
}

.receipt-document-v88 .receipt-paid-pill span {
  color: #067647;
  font-size: 6px;
  letter-spacing: .12em;
}

.receipt-document-v88 .receipt-paid-pill strong {
  margin-top: 1px;
  color: #067647;
  font-size: 16px;
  line-height: 1;
  letter-spacing: .12em;
}

.receipt-document-v88 .receipt-amount-panel {
  justify-content: flex-start;
}

.receipt-document-v88 .receipt-amount-panel > div {
  width: 100%;
}

@media print {
  .receipt-document-v88 .receipt-paid-pill {
    border-color: #12b76a !important;
    color: #067647 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* =========================================================
   V9.0 — Create New Order
   ========================================================= */
.manual-order-workspace {
  padding-bottom: 36px;
}

.manual-order-page-head {
  margin-bottom: 18px;
}

.manual-order-form {
  width: 100%;
}

.manual-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.manual-order-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.manual-order-card,
.manual-order-summary-card {
  background: #fff;
  border: 1px solid #e5eaf0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(11, 31, 59, .045);
}

.manual-order-card {
  padding: 20px;
}

.manual-order-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.manual-order-card-head > div:first-child {
  min-width: 0;
}

.manual-order-card-head h2,
.manual-order-summary-card h2 {
  margin: 3px 0 3px;
  color: #0b1f3b;
  font-size: 18px;
  letter-spacing: -.015em;
}

.manual-order-card-head p,
.manual-order-summary-card p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.55;
}

.manual-section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 7px;
  background: #eef4fb;
  color: #16345f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.manual-order-card-head-actions {
  align-items: center;
}

.manual-form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.manual-span-12 { grid-column: span 12; }
.manual-span-8 { grid-column: span 8; }
.manual-span-6 { grid-column: span 6; }
.manual-span-4 { grid-column: span 4; }
.manual-span-3 { grid-column: span 3; }
.manual-span-2 { grid-column: span 2; }

.manual-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.manual-field > span {
  color: #344054;
  font-size: 11px;
  font-weight: 750;
}

.manual-field > span b {
  color: #d92d20;
}

.manual-field > span small {
  color: #98a2b3;
  font-size: 10px;
  font-weight: 600;
}

.manual-field > small {
  color: #98a2b3;
  font-size: 10px;
  line-height: 1.4;
}

.manual-field input,
.manual-field select,
.manual-field textarea,
.manual-money-input {
  width: 100%;
  min-width: 0;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: #101828;
  font: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.manual-field input,
.manual-field select {
  height: 42px;
  padding: 0 11px;
}

.manual-field textarea {
  padding: 10px 11px;
  resize: vertical;
  min-height: 82px;
  line-height: 1.5;
}

.manual-field input:focus,
.manual-field select:focus,
.manual-field textarea:focus,
.manual-money-input:focus-within {
  border-color: #7b91ad;
  box-shadow: 0 0 0 3px rgba(11,31,59,.08);
}

.manual-readonly-value {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #f9fafb;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.manual-money-input {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  overflow: hidden;
}

.manual-money-input > span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  color: #667085;
  background: #f9fafb;
  border-right: 1px solid #eaecf0;
  font-weight: 800;
}

.manual-money-input input {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: 40px;
}

.manual-items {
  display: grid;
  gap: 12px;
}

.manual-item-card {
  border: 1px solid #e6ebf1;
  border-radius: 13px;
  background: #fbfcfe;
  padding: 14px;
}

.manual-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.manual-item-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0b1f3b;
  font-size: 11px;
  font-weight: 800;
}

.manual-item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #0b1f3b;
  color: #fff;
  font-size: 10px;
}

.manual-remove-item {
  border: 0;
  background: transparent;
  color: #b42318;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 7px;
}

.manual-remove-item:hover {
  background: #fff1f0;
}

.manual-line-total {
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #f8fafc;
  color: #0b1f3b;
  font-size: 12px;
  font-weight: 800;
}

.manual-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.manual-choice {
  position: relative;
  cursor: pointer;
}

.manual-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.manual-choice > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 72px;
  padding: 13px;
  border: 1px solid #d0d5dd;
  border-radius: 11px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.manual-choice strong {
  color: #344054;
  font-size: 11px;
}

.manual-choice small {
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
}

.manual-choice input:checked + span {
  box-shadow: 0 0 0 2px rgba(11,31,59,.04);
}

/* V9.3 — soft semantic payment-status choices */
.manual-choice > span {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}

.manual-choice > span::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  transform: scale(.72);
  transition: opacity .16s ease, transform .16s ease;
}

.manual-choice input:checked + span::after {
  opacity: 1;
  transform: scale(1);
}

.manual-choice-pod > span {
  background: #f4f8ff;
  border-color: #d9e5f5;
}
.manual-choice-pod strong { color: #234a7a; }
.manual-choice-pod small { color: #64748b; }
.manual-choice-pod > span::after { background: #dceaff; color: #234a7a; }
.manual-choice-pod input:checked + span {
  background: #edf4ff;
  border-color: #7da2d1;
  box-shadow: 0 0 0 3px rgba(35,74,122,.07);
}

.manual-choice-paid > span {
  background: #f1fbf5;
  border-color: #c7ead5;
}
.manual-choice-paid strong { color: #067647; }
.manual-choice-paid small { color: #5f7468; }
.manual-choice-paid > span::after { background: #d9f5e5; color: #067647; }
.manual-choice-paid input:checked + span {
  background: #eaf8f0;
  border-color: #6fc49a;
  box-shadow: 0 0 0 3px rgba(6,118,71,.07);
}

.manual-choice-not-paid > span {
  background: #fff6f5;
  border-color: #f2d4d0;
}
.manual-choice-not-paid strong { color: #b42318; }
.manual-choice-not-paid small { color: #806360; }
.manual-choice-not-paid > span::after { background: #fee4e2; color: #b42318; }
.manual-choice-not-paid input:checked + span {
  background: #fff0ee;
  border-color: #e59a92;
  box-shadow: 0 0 0 3px rgba(180,35,24,.06);
}

/* V9.3 — modern Manual Order SweetAlert treatment */
.manual-swal-popup {
  width: min(520px, calc(100vw - 28px)) !important;
  padding: 26px 26px 22px !important;
  border: 1px solid #e4e7ec !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .18) !important;
  font-family: inherit !important;
}

.manual-swal-title {
  margin: 0 !important;
  padding: 0 !important;
  color: #101828 !important;
  font-size: 22px !important;
  line-height: 1.22 !important;
  font-weight: 850 !important;
  letter-spacing: -.025em !important;
}

.manual-swal-html {
  margin: 12px 0 0 !important;
  padding: 0 !important;
  color: #475467 !important;
  font-size: 13px !important;
}

.manual-swal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 15px;
}
.manual-swal-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.manual-swal-icon-review { color: #234a7a; background: #eef4fb; border: 1px solid #d8e6f6; }
.manual-swal-icon-success { color: #067647; background: #ecfdf3; border: 1px solid #abefc6; }
.manual-swal-icon-error { color: #b42318; background: #fff1f0; border: 1px solid #fecdca; }
.manual-swal-icon-clear { color: #b54708; background: #fff7ed; border: 1px solid #fed7aa; }

.manual-swal-lead {
  max-width: 420px;
  margin: 0 auto 16px;
  color: #667085;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.manual-swal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  text-align: left;
}
.manual-swal-summary > div {
  min-width: 0;
  padding: 11px 12px;
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 12px;
}
.manual-swal-summary-wide { grid-column: 1 / -1; }
.manual-swal-summary span,
.manual-swal-order-id span {
  display: block;
  margin-bottom: 4px;
  color: #98a2b3;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.manual-swal-summary strong {
  display: block;
  overflow-wrap: anywhere;
  color: #1d2939;
  font-size: 13px;
  line-height: 1.35;
}
.manual-swal-summary-success > div { background: #fbfcfd; }

.manual-swal-order-id {
  margin-bottom: 10px;
  padding: 14px;
  text-align: center;
  background: #f5f8ff;
  border: 1px solid #d8e6f6;
  border-radius: 13px;
}
.manual-swal-order-id strong {
  color: #0b1f3b;
  font-size: 18px;
  letter-spacing: .015em;
}

.manual-swal-message {
  padding: 12px 13px;
  color: #475467;
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}
.manual-swal-message-error {
  color: #912018;
  background: #fff8f7;
  border-color: #fecdca;
}

.manual-swal-actions {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 10px !important;
  margin: 18px 0 0 !important;
}
.manual-swal-actions .manual-swal-confirm:only-child {
  grid-column: 1 / -1;
}
.manual-swal-confirm,
.manual-swal-cancel {
  min-height: 44px;
  margin: 0 !important;
  padding: 11px 16px !important;
  border-radius: 11px !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.manual-swal-confirm {
  color: #fff !important;
  background: #0b1f3b !important;
  border: 1px solid #0b1f3b !important;
  box-shadow: 0 8px 18px rgba(11,31,59,.16);
}
.manual-swal-confirm:hover { transform: translateY(-1px); background: #16345f !important; }
.manual-swal-cancel {
  color: #344054 !important;
  background: #fff !important;
  border: 1px solid #d0d5dd !important;
}
.manual-swal-cancel:hover { border-color: #98a2b3 !important; background: #f9fafb !important; }
.manual-swal-confirm-danger {
  background: #b42318 !important;
  border-color: #b42318 !important;
  box-shadow: 0 8px 18px rgba(180,35,24,.14);
}
.manual-swal-confirm-danger:hover { background: #912018 !important; }

@media (max-width: 520px) {
  .manual-swal-popup { padding: 22px 18px 18px !important; border-radius: 18px !important; }
  .manual-swal-title { font-size: 20px !important; }
  .manual-swal-summary { grid-template-columns: 1fr; }
  .manual-swal-summary-wide { grid-column: auto; }
  .manual-swal-actions { grid-template-columns: 1fr; }
  .manual-swal-actions .manual-swal-confirm:only-child { grid-column: auto; }
}

.manual-order-summary-card {
  position: sticky;
  top: 78px;
  padding: 18px;
}

.manual-summary-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid #edf0f4;
}

.manual-summary-heading .eyebrow {
  margin-bottom: 4px;
}

.manual-summary-customer {
  padding: 14px 0;
  border-bottom: 1px solid #edf0f4;
}

.manual-summary-customer span,
.manual-summary-lines span,
.manual-summary-total span,
.manual-summary-meta span {
  color: #667085;
  font-size: 10px;
  font-weight: 650;
}

.manual-summary-customer strong {
  display: block;
  margin-top: 4px;
  color: #101828;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.manual-summary-lines {
  display: grid;
  gap: 10px;
  padding: 14px 0;
}

.manual-summary-lines > div,
.manual-summary-meta > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-summary-lines strong {
  color: #344054;
  font-size: 11px;
}

.manual-summary-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -4px;
  padding: 15px 14px;
  border-radius: 12px;
  background: #0b1f3b;
}

.manual-summary-total span {
  color: rgba(255,255,255,.72);
}

.manual-summary-total strong {
  color: #fff;
  font-size: 20px;
  letter-spacing: -.02em;
}

.manual-summary-meta {
  display: grid;
  gap: 10px;
  padding: 14px 0 4px;
}

.manual-summary-meta strong {
  max-width: 60%;
  text-align: right;
  color: #344054;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.manual-submit-order {
  margin-top: 14px;
}

.manual-order-summary-card .button + .button {
  margin-top: 8px;
}

.manual-submit-note {
  margin: 10px 2px 0 !important;
  color: #98a2b3 !important;
  font-size: 9.5px !important;
  text-align: center;
}

@media (max-width: 1050px) {
  .manual-order-layout {
    grid-template-columns: 1fr;
  }

  .manual-order-summary-card {
    position: static;
  }

  .manual-order-summary-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .7fr);
    column-gap: 18px;
  }

  .manual-summary-heading,
  .manual-summary-customer,
  .manual-summary-lines,
  .manual-summary-meta,
  .manual-summary-total,
  .manual-order-summary-card #manualOrderError,
  .manual-order-summary-card .button,
  .manual-submit-note {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .manual-order-card {
    padding: 15px;
  }

  .manual-span-8,
  .manual-span-6,
  .manual-span-4,
  .manual-span-3,
  .manual-span-2 {
    grid-column: span 12;
  }

  .manual-choice-row {
    grid-template-columns: 1fr;
  }

  .manual-order-card-head-actions {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .manual-order-layout {
    gap: 12px;
  }

  .manual-order-card {
    border-radius: 13px;
    padding: 13px;
  }

  .manual-order-card-head {
    flex-direction: column;
  }

  .manual-order-card-head-actions .button {
    width: 100%;
  }

  .manual-form-grid {
    gap: 11px;
  }

  .manual-order-summary-card {
    display: block;
    padding: 14px;
    border-radius: 13px;
  }
}


/* =========================================================
   V9.5 — Confirmation review + order attention
   ========================================================= */
.order-attention-button {
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border: 1px solid #e4e7ec;
  border-radius: 11px;
  background: #fff;
  color: #475467;
  cursor: pointer;
  transition: .18s ease;
}
.order-attention-button:hover,
.order-attention-button:focus-visible {
  border-color: #b8c5d6;
  background: #f8fbff;
  outline: none;
}
.order-attention-button.has-orders {
  border-color: #f7c8c8;
  background: #fff8f8;
  color: #b42318;
}
.order-attention-button.fresh-arrival .order-attention-bell {
  animation: rf-bell-pulse 1.8s ease-in-out infinite;
}
.order-attention-bell {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f2f4f7;
}
.order-attention-button.has-orders .order-attention-bell { background: #fee4e2; }
.order-attention-bell svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.order-attention-copy { display: grid; line-height: 1; text-align: left; gap: 2px; }
.order-attention-copy small { font-size: 7px; text-transform: uppercase; letter-spacing: .08em; font-weight: 900; color: #667085; }
.order-attention-copy strong { font-size: 13px; color: inherit; }
.order-attention-fresh-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f04438;
  border: 2px solid #fff;
}
@keyframes rf-bell-pulse {
  0%, 100% { transform: rotate(0deg) scale(1); }
  12% { transform: rotate(-10deg) scale(1.04); }
  24% { transform: rotate(9deg) scale(1.04); }
  36% { transform: rotate(-5deg); }
  48% { transform: rotate(0deg); }
}

.status-sheet.confirm-mode { width: min(940px, calc(100% - 28px)); max-height: min(90dvh, 900px); }
.form-grid.confirm-order-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.form-field-span-1 { grid-column: span 1; }
.form-field-span-2 { grid-column: span 2; }
.form-field-span-3 { grid-column: span 3; }
.form-field-span-4 { grid-column: 1 / -1; }

.confirm-review-intro {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid #d7e5f5;
  border-radius: 12px;
  background: #f7fbff;
}
.confirm-review-intro > div { display: grid; gap: 2px; }
.confirm-review-intro strong { font-size: 11px; color: #0b1f3b; }
.confirm-review-intro small { font-size: 9px; color: #667085; }
.confirm-review-intro > span { white-space: nowrap; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; border-radius: 999px; padding: 6px 8px; }

.review-field { gap: 4px; min-width: 0; }
.review-field > span { font-size: 9px; }
.review-field-display {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 8px 8px 10px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #f9fafb;
}
.review-field-display strong {
  min-width: 0;
  color: #101828;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.review-edit-button {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  cursor: pointer;
}
.review-edit-button:hover { border-color: #98a2b3; background: #f2f4f7; }
.review-edit-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.review-field-editor { display: none; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.review-field.editing .review-field-display { display: none; }
.review-field.editing .review-field-editor { display: grid; }
.review-field-editor input,
.review-field-editor select { min-height: 39px; height: 39px; padding: 7px 9px; border-radius: 10px; font-size: 10px; }
.review-done-button {
  min-height: 39px;
  border: 1px solid #0b1f3b;
  border-radius: 9px;
  padding: 0 10px;
  background: #0b1f3b;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  cursor: pointer;
}
.review-field .field-hint { font-size: 8px; line-height: 1.25; }

.phone-verification-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #fedf89;
  background: #fffaeb;
  color: #93370d;
}
.phone-verification-status.valid { border-color: #abefc6; background: #ecfdf3; color: #067647; }
.phone-verification-status.invalid { border-color: #fecdca; background: #fef3f2; color: #b42318; }
.phone-verification-status > span { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.72); font-weight: 900; }
.phone-verification-status > div { display: grid; gap: 1px; }
.phone-verification-status strong { font-size: 9px; }
.phone-verification-status small { font-size: 8px; color: currentColor; opacity: .85; }

.address-verification-card {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 47px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d7e5f5;
  background: #f7fbff;
}
.address-verification-card strong { font-size: 9px; color: #0b1f3b; }
.address-verification-card small { font-size: 8px; color: #667085; line-height: 1.3; }

.statusActionForm.confirm-mode .checkbox-field,
.status-sheet.confirm-mode .checkbox-field {
  min-height: 44px;
  padding: 8px 9px;
  align-items: center;
  border-radius: 10px;
  font-size: 9px;
}
.status-sheet.confirm-mode .checkbox-field input { width: 15px; height: 15px; }
.status-sheet.confirm-mode #activityNoteInput { min-height: 52px; }
.status-sheet.confirm-mode .sheet-body { padding-top: 12px; }
.status-sheet.confirm-mode .sheet-actions { margin-top: 11px; }

@media (max-width: 820px) {
  .status-sheet.confirm-mode { width: min(100% - 16px, 720px); max-height: 94dvh; border-radius: 18px; }
  .form-grid.confirm-order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .confirm-order-grid .form-field-span-4 { grid-column: 1 / -1; }
  .confirm-order-grid .form-field-span-3 { grid-column: 1 / -1; }
  .confirm-order-grid .form-field-span-2 { grid-column: span 1; }
  .confirm-review-intro { align-items: flex-start; }
  .order-attention-copy small { display: none; }
  .order-attention-button { padding-right: 8px; gap: 5px; }
}
@media (max-width: 520px) {
  .form-grid.confirm-order-grid { grid-template-columns: 1fr; }
  .confirm-order-grid .form-field-span-1,
  .confirm-order-grid .form-field-span-2,
  .confirm-order-grid .form-field-span-3,
  .confirm-order-grid .form-field-span-4 { grid-column: auto; }
  .confirm-review-intro { display: grid; }
  .confirm-review-intro > span { justify-self: start; }
  .phone-verification-status { grid-column: auto; }
  .order-attention-button { min-width: 46px; justify-content: center; }
  .order-attention-copy { display: none; }
}

/* V9.6 — stronger reschedule/cancel workflows + deliberate address verification */
.confirm-message {
  font-size: 11px;
  line-height: 1.55;
  color: #667085;
}
.confirm-message > p {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}
.address-confirm-summary {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  border: 1px solid #d7e5f5;
  border-radius: 13px;
  overflow: hidden;
  background: #f8fbff;
}
.address-confirm-summary > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
}
.address-confirm-summary > div + div {
  border-top: 1px solid #e4edf7;
}
.address-confirm-summary span {
  color: #667085;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.address-confirm-summary strong {
  color: #101828;
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.address-confirm-question {
  margin: 11px 0 0 !important;
  padding: 9px 10px;
  border-radius: 10px;
  background: #fffaeb;
  color: #93370d;
  font-size: 10px !important;
  font-weight: 750;
}

.status-sheet.reschedule-mode,
.status-sheet.cancel-mode {
  width: min(760px, calc(100% - 28px));
}
.status-sheet.reschedule-mode .form-grid,
.status-sheet.cancel-mode .form-grid {
  gap: 10px;
}
.workflow-form-hero {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid #d7e5f5;
  background: #f7fbff;
}
.workflow-form-hero.cancel {
  border-color: #fecdca;
  background: #fef6f5;
}
.workflow-form-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eaf3ff;
  color: #175cd3;
  font-size: 18px;
  font-weight: 900;
}
.workflow-form-hero.cancel .workflow-form-icon {
  background: #fee4e2;
  color: #b42318;
}
.workflow-form-hero > div {
  display: grid;
  gap: 3px;
}
.workflow-form-hero strong {
  color: #0b1f3b;
  font-size: 11px;
  font-weight: 900;
}
.workflow-form-hero.cancel strong { color: #912018; }
.workflow-form-hero small {
  color: #667085;
  font-size: 9px;
  line-height: 1.45;
}
.status-sheet.reschedule-mode #dynamicStatusFields > .form-field,
.status-sheet.cancel-mode #dynamicStatusFields > .form-field {
  min-height: 78px;
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fcfcfd;
}
.status-sheet.reschedule-mode #dynamicStatusFields > .form-field:focus-within {
  border-color: #b2ddff;
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(23,92,211,.05);
}
.status-sheet.cancel-mode #dynamicStatusFields > .form-field:focus-within {
  border-color: #fda29b;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(180,35,24,.04);
}
.status-sheet.reschedule-mode #dynamicStatusFields select,
.status-sheet.reschedule-mode #dynamicStatusFields input,
.status-sheet.cancel-mode #dynamicStatusFields select,
.status-sheet.cancel-mode #dynamicStatusFields input {
  min-height: 40px;
  border-radius: 10px;
}
.status-sheet.reschedule-mode #f_nextAt:disabled {
  background: #f2f4f7;
  color: #98a2b3;
  cursor: not-allowed;
}

@media (max-width: 620px) {
  .address-confirm-summary > div {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .status-sheet.reschedule-mode,
  .status-sheet.cancel-mode {
    width: min(100% - 16px, 720px);
    max-height: 94dvh;
  }
  .workflow-form-hero {
    align-items: flex-start;
  }
}

/* =========================================================
   V9.7 — delivery workflow refinement
   ========================================================= */
.status-sheet.transit-mode,
.status-sheet.delivered-mode,
.status-sheet.failed-mode {
  width: min(900px, calc(100% - 28px));
  max-height: min(90dvh, 900px);
}

.workflow-form-hero.transit {
  border-color: #d9d6fe;
  background: #f7f5ff;
}
.workflow-form-hero.transit .workflow-form-icon {
  background: #eee9ff;
  color: #6941c6;
}
.workflow-form-hero.transit strong { color: #53389e; }

.workflow-form-hero.delivered {
  border-color: #abefc6;
  background: #f0fdf4;
}
.workflow-form-hero.delivered .workflow-form-icon {
  background: #dcfae6;
  color: #067647;
}
.workflow-form-hero.delivered strong { color: #05603a; }

.workflow-form-hero.failed {
  border-color: #fecdd6;
  background: #fff5f7;
}
.workflow-form-hero.failed .workflow-form-icon {
  background: #ffe4e8;
  color: #c01048;
}
.workflow-form-hero.failed strong { color: #9f1239; }

.status-sheet.transit-mode #dynamicStatusFields > .form-field,
.status-sheet.failed-mode #dynamicStatusFields > .form-field {
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fcfcfd;
}
.status-sheet.transit-mode #dynamicStatusFields > .form-field:focus-within {
  border-color: #c7b9ff;
  background: #faf9ff;
  box-shadow: 0 0 0 3px rgba(105,65,198,.05);
}
.status-sheet.failed-mode #dynamicStatusFields > .form-field:focus-within {
  border-color: #fda4af;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(190,18,60,.04);
}
.status-sheet.transit-mode #dynamicStatusFields input,
.status-sheet.transit-mode #dynamicStatusFields select,
.status-sheet.failed-mode #dynamicStatusFields input,
.status-sheet.failed-mode #dynamicStatusFields select {
  min-height: 39px;
  border-radius: 10px;
}

.delivery-locked-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.delivery-locked-summary > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #d1fadf;
  border-radius: 11px;
  background: #f6fef9;
}
.delivery-locked-summary span {
  color: #667085;
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.delivery-locked-summary strong {
  color: #101828;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.status-sheet.delivered-mode .review-field-display {
  border-color: #d1fadf;
  background: #f6fef9;
}
.status-sheet.delivered-mode .review-edit-button {
  color: #067647;
  border-color: #abefc6;
  background: #fff;
}
.status-sheet.delivered-mode .review-done-button {
  border-color: #067647;
  background: #067647;
}

.compact-partner-grid {
  padding: 9px 10px;
  border: 1px dashed #d9d6fe;
  border-radius: 12px;
  background: #faf9ff;
}

.logistics-handoff-card {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid #e4e7ec;
  border-radius: 11px;
  background: #f8fafc;
}
.logistics-handoff-card span {
  color: #667085;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.logistics-handoff-card strong {
  color: #344054;
  font-size: 9px;
}
.logistics-handoff-card small {
  color: #667085;
  font-size: 8px;
  line-height: 1.4;
}

@media (max-width: 820px) {
  .status-sheet.transit-mode,
  .status-sheet.delivered-mode,
  .status-sheet.failed-mode {
    width: min(100% - 16px, 720px);
    max-height: 94dvh;
  }
}

@media (max-width: 520px) {
  .delivery-locked-summary { grid-template-columns: 1fr; }
  .compact-partner-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   V9.8 — Rep work queue + smarter follow-up attention
   ========================================================= */
.work-queue-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.work-queue-card {
  min-width: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  color: #344054;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.work-queue-card:hover,
.work-queue-card:focus-visible {
  transform: translateY(-1px);
  outline: none;
  border-color: #c9d5e3;
  box-shadow: 0 8px 20px rgba(11,31,59,.07);
}
.work-queue-card.active {
  border-color: #9db4cf;
  box-shadow: 0 0 0 3px rgba(11,31,59,.07);
}
.work-queue-card > span:last-child { min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: baseline; }
.work-queue-card small { font-size: 10px; font-weight: 900; color: #344054; }
.work-queue-card strong { grid-row: 1 / span 2; grid-column: 2; font-size: 24px; line-height: 1; color: #0b1f3b; letter-spacing: -.03em; }
.work-queue-card em { grid-column: 1; font-size: 9px; font-style: normal; color: #667085; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.work-queue-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
  background: #f2f4f7;
  color: #475467;
}
.work-queue-card.fresh { background: #f8fbff; border-color: #d9e6f5; }
.work-queue-card.fresh .work-queue-icon { background: #eaf3ff; color: #175cd3; }
.work-queue-card.due { background: #fffcf5; border-color: #f3e5bd; }
.work-queue-card.due .work-queue-icon { background: #fff3d6; color: #b54708; }
.work-queue-card.overdue { background: #fff8f7; border-color: #f2d1cd; }
.work-queue-card.overdue .work-queue-icon { background: #fee4e2; color: #b42318; }
.work-queue-card.overdue.has-items strong { color: #b42318; }
.work-queue-card.upcoming { background: #f8fafc; border-color: #e1e7ef; }
.work-queue-card.upcoming .work-queue-icon { background: #eef2f6; color: #344054; }

.order-attention-wrap { position: relative; }
.order-attention-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 120;
  width: min(330px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(15,23,42,.16);
}
.attention-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 9px;
}
.attention-popover-head > div { display: grid; gap: 3px; }
.attention-popover-head strong { font-size: 12px; color: #101828; }
.attention-popover-head span { font-size: 9px; color: #667085; line-height: 1.4; }
.attention-popover-close {
  border: 0;
  background: #f2f4f7;
  color: #667085;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.attention-popover-list { display: grid; gap: 5px; }
.attention-popover-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #edf0f3;
  border-radius: 11px;
  background: #fbfcfd;
  color: #344054;
  text-align: left;
  cursor: pointer;
}
.attention-popover-row:hover { background: #f6f9fc; border-color: #dbe4ee; }
.attention-popover-row > span { display: grid; gap: 2px; }
.attention-popover-row strong { font-size: 10px; color: #344054; }
.attention-popover-row small { font-size: 8px; color: #667085; }
.attention-popover-row b {
  min-width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
}
.attention-popover-row.urgent { background: #fff8f7; border-color: #f3d3cf; }
.attention-popover-row.urgent b { background: #fee4e2; color: #b42318; }

.workflow-form-hero.followup {
  background: linear-gradient(135deg, #f5f9ff 0%, #eef5fd 100%);
  border-color: #d6e5f5;
}
.workflow-form-hero.followup .workflow-form-icon { background: #dcecff; color: #175cd3; }
.followup-schedule-card {
  border: 1px solid #dfe7f0;
  border-radius: 14px;
  background: #fbfdff;
  padding: 12px;
}
.followup-schedule-head { margin-bottom: 9px; }
.followup-schedule-head > div { display: grid; gap: 2px; }
.followup-schedule-head strong { font-size: 10px; color: #344054; }
.followup-schedule-head small { font-size: 9px; color: #667085; }
.followup-quick-times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.followup-quick-times button {
  border: 1px solid #d6e1ed;
  border-radius: 999px;
  padding: 6px 9px;
  background: #fff;
  color: #344054;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}
.followup-quick-times button:hover,
.followup-quick-times button.selected {
  border-color: #9bb7d5;
  background: #eef5fd;
  color: #0b1f3b;
}
.followup-schedule-card .form-field { margin: 0; }

@media (max-width: 980px) {
  .work-queue-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .work-queue-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .work-queue-card { min-height: 67px; grid-template-columns: 29px 1fr; gap: 7px; padding: 9px; border-radius: 12px; }
  .work-queue-icon { width: 29px; height: 29px; border-radius: 9px; font-size: 14px; }
  .work-queue-card strong { font-size: 20px; }
  .work-queue-card small { font-size: 9px; }
  .work-queue-card em { display: none; }
  .order-attention-popover { position: fixed; top: 58px; right: 8px; left: 8px; width: auto; }
}

/* V9.8 attention severity overrides */
.order-attention-button.has-orders {
  border-color: #d7e3ef;
  background: #f8fbff;
  color: #175cd3;
}
.order-attention-button.has-orders .order-attention-bell { background: #eaf3ff; }
.order-attention-button.has-due:not(.has-overdue) {
  border-color: #efdba6;
  background: #fffcf5;
  color: #b54708;
}
.order-attention-button.has-due:not(.has-overdue) .order-attention-bell { background: #fff3d6; }
.order-attention-button.has-overdue {
  border-color: #f0c7c2;
  background: #fff8f7;
  color: #b42318;
}
.order-attention-button.has-overdue .order-attention-bell { background: #fee4e2; }
@media (max-width: 520px) {
  .order-attention-button { min-width: 54px; padding: 5px 7px; gap: 4px; }
  .order-attention-copy { display: grid; }
  .order-attention-copy small { display: none; }
  .order-attention-copy strong { font-size: 12px; }
}


/* =========================================================
   V10.1 — Compact header Contact Attempt action
   ========================================================= */
.drawer-header-main {
  min-width: 0;
  flex: 1 1 auto;
}
.drawer-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.header-contact-attempt-action {
  margin: 0;
}
.log-contact-attempt-button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  padding: 7px 10px;
  background: #0b1f3b;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(11,31,59,.16);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.log-contact-attempt-button:hover,
.log-contact-attempt-button:focus-visible {
  background: #16345f;
  transform: translateY(-1px);
  box-shadow: 0 7px 15px rgba(11,31,59,.22);
}
.log-contact-attempt-button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.log-contact-attempt-icon {
  width: auto;
  height: auto;
  display: inline;
  background: transparent;
  color: currentColor;
  font-size: 13px;
  font-weight: 900;
}
@media (max-width: 520px) {
  .drawer-header { padding: 14px 12px 12px; gap: 8px; }
  .drawer-header-actions { gap: 6px; }
  .log-contact-attempt-button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 9px;
  }
  .log-contact-attempt-icon { font-size: 12px; }
}

/* V10.0 deployed-version marker */
.app-version-label {
  margin-left: auto;
  align-self: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #98a2b3;
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 999px;
  padding: 4px 7px;
  white-space: nowrap;
}

/* V10.3 — Waybill Arrived logistics status */
.status-badge[data-status="Waybill Arrived"] {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.drawer-status-action[data-status="Waybill Arrived"] {
  background: #2563eb;
  color: #fff;
}

.status-sheet.waybill-arrived-mode .status-sheet-header {
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.workflow-form-hero.waybill-arrived {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.workflow-form-hero.waybill-arrived .workflow-form-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

/* =========================================================
   V11.0 — ADMIN WORKSPACE
   ========================================================= */
.sidebar-menu-group { display: contents; }
.sidebar-menu-group[hidden] { display: none !important; }

.admin-workspace { padding-bottom: 40px; }
.admin-view { display: grid; gap: 16px; }
.admin-view[hidden] { display: none !important; }

.admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px;
  border: 1px solid #dfe7f1;
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
  box-shadow: var(--shadow-sm);
}
.admin-hero.compact { padding: 20px 22px; }
.admin-hero h2 { margin: 3px 0 5px; color: var(--navy); font-size: 24px; letter-spacing: -.03em; }
.admin-hero p { margin: 0; color: var(--muted); max-width: 720px; font-size: 12px; line-height: 1.55; }

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.admin-metric {
  padding: 17px;
  border-radius: 16px;
  border: 1px solid #dfe7f1;
  background: #fff;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.admin-metric span { display: block; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; color: #667085; }
.admin-metric strong { display: block; margin: 7px 0 3px; font-size: 26px; line-height: 1; color: var(--navy); letter-spacing: -.04em; }
.admin-metric small { color: #98a2b3; font-size: 10px; }

.admin-overview-grid,
.admin-health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-panel {
  background: #fff;
  border: 1px solid #dfe7f1;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.admin-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.admin-panel-head h3 { margin: 2px 0 0; color: var(--navy); font-size: 15px; }
.admin-panel-kicker { display: block; color: #667085; font-size: 9px; font-weight: 900; letter-spacing: .12em; }

.admin-recent-list,
.admin-health-list { display: grid; gap: 8px; }
.admin-recent-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #eef2f6;
  padding: 10px 0;
}
.admin-recent-row:first-child { border-top: 0; padding-top: 0; }
.admin-avatar,
.admin-user-avatar {
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #eef4fb;
  color: var(--navy);
  font-weight: 900;
  flex: 0 0 auto;
}
.admin-avatar { width: 34px; height: 34px; font-size: 12px; }
.admin-recent-row > div { display: grid; gap: 2px; min-width: 0; }
.admin-recent-row strong { font-size: 11px; color: #101828; }
.admin-recent-row span,
.admin-recent-row time { color: #667085; font-size: 10px; }
.admin-recent-row time { white-space: nowrap; }

.admin-quick-health-row,
.admin-environment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e7edf4;
  border-radius: 13px;
  background: #fbfdff;
}
.admin-quick-health-row > div,
.admin-environment-item > div { display: grid; gap: 2px; }
.admin-quick-health-row strong,
.admin-environment-item strong { font-size: 11px; color: #1d2939; }
.admin-quick-health-row span,
.admin-environment-item span { font-size: 10px; color: #667085; }
.admin-config-dot { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; flex: 0 0 auto; }
.admin-config-dot.ok { background: #12b76a; box-shadow: 0 0 0 4px #ecfdf3; }
.admin-config-dot.bad { background: #f04438; box-shadow: 0 0 0 4px #fef3f2; }

.admin-team-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) 180px 150px; gap: 10px; margin-bottom: 14px; }
.admin-search { margin: 0; }
.admin-search.wide { grid-column: 1 / -1; max-width: none; }
.admin-team-toolbar select { min-height: 40px; border-radius: 11px; border: 1px solid #d8e1eb; background: #fff; color: #344054; padding: 0 11px; font-size: 11px; font-weight: 750; }

.admin-user-list { display: grid; gap: 9px; }
.admin-user-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid #e4eaf1;
  border-radius: 15px;
  background: #fff;
}
.admin-user-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.admin-user-avatar { width: 40px; height: 40px; font-size: 13px; }
.admin-user-copy { display: grid; gap: 3px; min-width: 0; }
.admin-user-copy > span,
.admin-user-copy > small { color: #667085; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-user-name-row strong { font-size: 12px; color: #101828; }
.admin-user-status,
.admin-you-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.admin-user-status.active { color: #067647; background: #ecfdf3; border: 1px solid #abefc6; }
.admin-user-status.inactive { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; }
.admin-you-badge { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }
.admin-role-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.admin-role-chips span { padding: 3px 7px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 8.5px; font-weight: 800; }
.admin-user-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.button-soft-danger { background: #fff6f5; border: 1px solid #fecdca; color: #b42318; }
.button-soft-success { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; }

.admin-role-editor {
  grid-column: 1 / -1;
  border-top: 1px solid #edf1f5;
  padding-top: 12px;
  display: grid;
  gap: 11px;
}
.admin-role-editor[hidden] { display: none !important; }
.admin-role-editor > div:first-child { display: grid; gap: 2px; }
.admin-role-editor > div:first-child strong { font-size: 11px; color: var(--navy); }
.admin-role-editor > div:first-child span { font-size: 9.5px; color: #667085; }
.admin-inline-role-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.admin-inline-role,
.admin-role-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #dfe7f1;
  border-radius: 10px;
  background: #fbfdff;
  cursor: pointer;
}
.admin-inline-role input,
.admin-role-option input { width: auto; margin: 0; accent-color: var(--navy); }
.admin-inline-role span { font-size: 10px; font-weight: 800; color: #344054; }
.admin-role-editor-actions { display: flex; justify-content: flex-end; gap: 7px; }

.admin-create-user { border-color: #cbdcf0; background: linear-gradient(180deg, #fff 0%, #f8fbff 100%); }
.admin-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.admin-form-grid label { display: grid; gap: 6px; font-size: 10px; font-weight: 850; color: #344054; }
.admin-form-grid label small { color: #98a2b3; font-size: 8.5px; font-weight: 700; }
.admin-form-grid em,
.admin-field-label em { color: #d92d20; font-style: normal; }
.admin-form-grid input { width: 100%; min-height: 40px; border: 1px solid #d8e1eb; border-radius: 11px; padding: 0 11px; font-size: 11px; color: #101828; background: #fff; }
.admin-form-span { grid-column: 1 / -1; }
.admin-field-label { display: block; margin-bottom: 7px; font-size: 10px; font-weight: 850; color: #344054; }
.admin-role-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.admin-role-option span { display: grid; gap: 1px; }
.admin-role-option strong { font-size: 10px; color: #344054; }
.admin-role-option small { font-size: 8.5px; color: #98a2b3; }
.admin-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-form-actions .form-message { margin: 0; }

.admin-setup-link {
  position: sticky;
  bottom: 12px;
  z-index: 15;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: end;
  border: 1px solid #b2ddff;
  background: #eff8ff;
  box-shadow: 0 18px 40px rgba(11,31,59,.16);
}
.admin-setup-link > div { display: grid; gap: 2px; }
.admin-setup-link > div strong { font-size: 11px; color: var(--navy); }
.admin-setup-link > div span { color: #475467; font-size: 9px; }

.admin-audit-list { display: grid; }
.admin-audit-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 4px;
  border-bottom: 1px solid #edf1f5;
}
.admin-audit-row:last-child { border-bottom: 0; }
.admin-audit-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #7f9fc5; box-shadow: 0 0 0 4px #eef4fb; }
.admin-audit-copy { display: grid; gap: 3px; min-width: 0; }
.admin-audit-copy strong { font-size: 11px; color: #1d2939; }
.admin-audit-copy span { font-size: 9.5px; color: #667085; }
.admin-audit-copy small { font-size: 9px; color: #475467; line-height: 1.45; word-break: break-word; }
.admin-audit-meta { display: grid; gap: 3px; text-align: right; }
.admin-audit-meta time,
.admin-audit-meta span { font-size: 9px; color: #98a2b3; white-space: nowrap; }

.admin-health-badge { border-radius: 999px; padding: 5px 9px; font-size: 8.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.admin-health-badge.neutral { background: #f2f4f7; color: #667085; }
.admin-health-badge.ok { background: #ecfdf3; color: #067647; border: 1px solid #abefc6; }
.admin-health-badge.bad { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.admin-environment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.admin-security-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #f8fafc; color: #667085; font-size: 9.5px; }
.admin-empty { padding: 28px 14px; text-align: center; color: #98a2b3; font-size: 11px; }

@media (max-width: 1180px) {
  .admin-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-role-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .admin-hero { align-items: flex-start; padding: 18px; }
  .admin-hero h2 { font-size: 21px; }
  .admin-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-overview-grid,
  .admin-health-grid { grid-template-columns: 1fr; }
  .admin-team-toolbar { grid-template-columns: 1fr 1fr; }
  .admin-search { grid-column: 1 / -1; }
  .admin-user-card { grid-template-columns: 1fr; }
  .admin-user-actions { justify-content: flex-start; padding-left: 51px; }
  .admin-setup-link { position: static; grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .admin-hero { display: grid; gap: 14px; }
  .admin-metric-grid { grid-template-columns: 1fr 1fr; }
  .admin-metric { padding: 14px; }
  .admin-metric strong { font-size: 23px; }
  .admin-panel { padding: 14px; border-radius: 15px; }
  .admin-team-toolbar { grid-template-columns: 1fr; }
  .admin-search { grid-column: auto; }
  .admin-form-grid,
  .admin-role-picker,
  .admin-environment-grid { grid-template-columns: 1fr; }
  .admin-form-span { grid-column: auto; }
  .admin-form-actions { align-items: stretch; flex-direction: column; }
  .admin-form-actions .button { width: 100%; }
  .admin-user-main { align-items: flex-start; }
  .admin-user-copy > span,
  .admin-user-copy > small { white-space: normal; }
  .admin-user-actions { padding-left: 0; }
  .admin-user-actions .button { flex: 1; }
  .admin-recent-row { grid-template-columns: 34px minmax(0,1fr); }
  .admin-recent-row time { grid-column: 2; }
  .admin-audit-row { grid-template-columns: 10px 1fr; }
  .admin-audit-meta { grid-column: 2; text-align: left; display: flex; gap: 8px; flex-wrap: wrap; }
}

/* V11.1 Admin company-control navigation */
.admin-control-label { margin-top: 10px; color: #54708f; }
body:not(.sidebar-expanded) .admin-control-label { display: none; }

.finance-money-value{font-size:20px!important;letter-spacing:-.02em;}

.admin-finance-drawer-block{background:#f8fbff;border-color:#dbe7f5;}
.admin-finance-update{margin-top:12px;}
.admin-payment-modal-copy{font-size:14px;line-height:1.6;color:#344054;margin-bottom:10px;}

.admin-ownership-drawer-block{background:#fbfcfe;border-color:#dfe6ee;}
.admin-reassign-order{margin-top:12px;}
