/* Etsy Orders ā€“ styles.css v50 */

:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --muted: #6b7280;
  --txt: #0b2a5e;
  --br: #e5e7eb;
  --radius: 12px;
  --primary: #4f46e5;
  --blue: #2563eb;
  --success: #16a34a;
  --danger: #ef4444;
  --chip-border: #1e3a8a;
  --topbar-height: 64px;
  --memo-thumb-size: 200px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.45 system-ui, Segoe UI, Roboto, Helvetica, Arial;
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.label { font-weight: 700; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Amazon stock meta (last update timestamps) */
.stock-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--txt);
  font: 600 14px/1.2 system-ui, Segoe UI, Roboto, Helvetica, Arial;
}
.stock-meta .pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--br);
  background: #f3f4f6;
  color: #111827;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stock-meta .pill.clickable {
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.stock-meta .pill.clickable:focus-visible,
.stock-meta .pill.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.12);
}
.stock-meta .pill.fresh {
  background: #dcfce7;
  border-color: #86efac;
  color: #065f46;
}
.stock-meta .pill.stale {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid var(--br);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand .title { font-size: 18px; }
.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.title .subtitle { display: block; color: var(--muted); font-size: 12px; }
.mainnav { display: flex; gap: 6px; align-items: center; }
.mainnav-fallback {
  flex-direction: column;
  align-items: flex-start;
}
.mainnav-fallback .nav-warning {
  font-size: 12px;
  color: #92400e;
  background: #fff7ed;
  border: 1px dashed #fcd34d;
  border-radius: 8px;
  padding: 6px 10px;
}
.nav-btn {
  padding: 8px 10px;
  border: 1px solid var(--br);
  border-radius: 8px;
  background: #fff;
  color: var(--txt);
  font-weight: 700;
  line-height: 1;
}
.nav-btn.active { background: #eef2ff; border-color: #c7d2fe; color: var(--primary); }
.nav-btn .memo-count {
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #e5e7eb;
  color: #1f2937;
}
.nav-btn .memo-count.has-new {
  background: #fee2e2;
  color: #991b1b;
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown > .nav-btn {
  cursor: pointer;
  user-select: none;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 6px;
  min-width: 160px;
  z-index: 100;
}
.nav-dropdown-menu-inner {
  background: #fff;
  border: 1px solid var(--br);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  padding: 4px 0;
}
.nav-dropdown:hover .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
}
.nav-dropdown-item {
  display: block;
  padding: 10px 16px;
  color: var(--txt);
  font-weight: 600;
  white-space: nowrap;
  border-radius: 6px;
  margin: 2px 4px;
}
.nav-dropdown-item:hover {
  background: #f3f4f6;
}
.nav-dropdown-item.active {
  background: #eef2ff;
  color: var(--primary);
}

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 61;
  position: relative;
}
.hamburger-bar {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--txt, #111);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
/* Hamburger icon stays as 3 bars in all states (no X transform) */

/* Desktop: nav-links is a normal flex row */
.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.nav-links-mobile {
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.nav-links-mobile .nav-btn {
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  white-space: normal;
}
.nav-links-mobile .nav-dropdown { display: none; }
.nav-links-mobile .nav-btn-mobile-admin { display: block; }

/* Mobile-only admin links hidden on desktop */
.nav-btn-mobile-admin { display: none; }

.mobile-nav-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 12000;
  align-items: stretch;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s .28s;
}
.mobile-nav-drawer.open {
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s 0s;
}
.mobile-nav-overlay {
  flex: 1;
  border: 0;
  background: rgba(0,0,0,.35);
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0;
  transition: opacity .25s ease;
}
.mobile-nav-panel {
  width: 280px;
  max-width: 85%;
  height: 100%;
  background: #fff;
  border-left: 1px solid var(--br);
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  padding: 60px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  transform: translateX(24px);
  opacity: 0;
  transition: transform .26s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
}

body.nav-menu-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .nav-links-desktop { display: none !important; }
}

/* Animate to visible state when open */
.mobile-nav-drawer.open .mobile-nav-overlay { opacity: 1; }
.mobile-nav-drawer.open .mobile-nav-panel { transform: translateX(0); opacity: 1; }

/* Close button inside the drawer */
.mobile-nav-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--br);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.mobile-nav-close .hamburger-bar {
  width: 18px;
  height: 2px;
  background: var(--txt, #111);
  border-radius: 2px;
  opacity: 1;
  transform: none;
}
.mobile-nav-close:hover { background: #f9fafb; }
.mobile-nav-close:active { transform: translateY(1px); }


@media (prefers-reduced-motion: reduce) {
  .mobile-nav-drawer,
  .mobile-nav-overlay,
  .mobile-nav-panel,
  .mobile-nav-drawer.open .mobile-nav-panel {
    transition: none !important;
    transform: none !important;
  }
}

/* Layout */
.page-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 16px;
  padding: 12px;
}
.page-grid:not(.tracking-page) > main.panel {
  position: relative;
}
.page-grid:not(.tracking-page) > main.panel > .table-wrap {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
}
.page-grid:not(.tracking-page) > main.panel > .table-wrap > .table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.page-grid.single { grid-template-columns: 1fr; }
.panel {
  background: var(--card);
  border: 1px solid var(--br);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Nested sub‑panes: make borders/background darker for visibility timmo*/

.panel .panel {



  background: #e4e8ed;
  border: 1px solid #9aa4b3;
}

/* Hide stray admin action buttons that appear as direct children of a panel */
.panel > #btnPurgeSelected,
.panel > #btnPurgeActiveAll,
.panel > #btnPurgeArchivedAll,
.panel > #btnPullEtsyCompleted { display: none !important; }
.panel-header { display: flex; align-items: center; gap: 8px; }
.panel-header h3 { margin: 0; }
.panel-header .sep { flex: 1; height: 1px; background: var(--br); opacity: .9; }
.left-panel {
  position: sticky;
  top: var(--topbar-height, 64px);
  align-self: start;
  max-height: calc(100vh - var(--topbar-height, 64px));
  overflow: hidden;
  padding: 0;
}
.left-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}
@media (max-width: 768px) {
  .left-panel {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
    padding: 0;
  }
  .left-panel-scroll {
    overflow-y: visible;
  }
}
.panel.orders-panel { overflow: auto; }

/* Forms */
.form-grid { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.input {
  display: block;
  width: 100%;

  padding: 8px 10px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
}
.input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.input.input-error {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(239,68,68,.2);
}

/* Suggestions (typeahead) */
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 42px;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--br);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  overflow: hidden;
}
.sugg-item { padding: 8px 10px; cursor: pointer; }
.sugg-item:hover { background: #f3f4f6; }
/* Support both class names used by JS: suggest-item and sugg-item */
.suggestions .suggest-item,
.suggestions .sugg-item {
  padding: 12px 12px;
  cursor: pointer;
  line-height: 1.4;
}
.suggestions .suggest-item + .suggest-item,
.suggestions .sugg-item + .sugg-item {
  border-top: 1px solid #eef2f7;
}
.suggestions .suggest-item:hover,
.suggestions .sugg-item:hover,
.suggestions .suggest-item.active,
.suggestions .sugg-item.active {
  background: #e6f0ff;
}

/* Buttons */
.btn {
  background: #fff;
  border: 2px solid #9aa4b3;
  color: var(--txt);
  border-radius: 5px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.btn:hover { filter: brightness(.97); }
.btn.small { padding: 4px 7px; font-size: 12px; }
.btn.block {
  display: block;
  width: 100%;
  text-align: center;
}
.btn.secondary { background: #f3f4f6; border-color: #e5e7eb; color: #111827; }
.btn.primary { border-color: #c7d2fe; background: #eef2ff; }
.btn.blue { border-color: #93c5fd; background: #dbeafe; }
.btn.blue.btn-xl { padding: 9px 12px; }
.btn.success { border-color: #86efac; background: #dcfce7; }
.btn.danger { border-color: #c57b7b; background: #f9b5b5; }
.btn.btn-returned {
  border-color: #c4b5fd;
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 600;
}
.btn.btn-returned:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn.file { background: #fef3c7; border-color: #fde68a; }
.btn.toggle { background: #fff; }
.btn.toggle.active { background: #3b82f6; border-color: #2563eb; color: #fff; }
.btn.cta {
  background: #7ca3f9;
  border-color: #688fe5;
  color: #0e2049;
  padding: 12px 18px;


  border-radius: 5px;

}
.btn.cta:hover {
  background: #82a9fc;
  box-shadow: 0 6px 12px rgba(37,99,235,.28);
}
.memo-top-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eef2ff;
  border-color: #c7d2fe;
  border-radius: 999px;
  padding: 6px 14px;
}
.memo-top-add span {
  font-weight: 700;
}
.memo-go-link {
  background: #dbeafe;
  border-color: #bfdbfe;
  border-radius: 8px;
  padding: 8px 12px;
}

/* Team memo board */
.team-memo-board {
  margin: 16px 12px;
  padding: 18px;
  border: 1px solid var(--br);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}
.team-memo-board .memo-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.team-memo-board .memo-headline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.team-memo-board.memo-has-new .memo-headline {
  background: #ecfdf5;
  border-radius: 12px;
  padding: 10px 12px;
  margin: -6px -6px 0;
  border: 2px dashed #34d399;
}
.team-memo-board .memo-toggle-btn {
  line-height: 1.2;
  font-weight: 600;
  border: 1px solid var(--br);
  background: #f8fafc;
  color: #1f2937;
}
.team-memo-board .memo-toggle-btn:hover,
.team-memo-board .memo-toggle-btn:focus-visible {
  border-color: #c7d2fe;
  color: var(--blue);
}
.team-memo-board.memo-has-new .memo-toggle-btn {
  border-color: #86efac;
  background: #d1fae5;
  color: #065f46;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}
.team-memo-board.memo-has-new .memo-toggle-btn:hover,
.team-memo-board.memo-has-new .memo-toggle-btn:focus-visible {
  border-color: #4ade80;
  color: #065f46;
}
.team-memo-board .memo-toggle-btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}
.team-memo-board .memo-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 2px;
}
.team-memo-board .memo-subtitle {
  font-size: 13px;
  color: var(--muted);
  max-width: 640px;
}
.team-memo-board .memo-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border-color: #c7d2fe;
  background: #eef2ff;
}
.team-memo-board .memo-add-btn img {
  width: 16px;
  height: 16px;
}
.team-memo-board .memo-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.team-memo-board.memo-collapsed {
  padding-bottom: 10px;
}
.team-memo-board.memo-collapsed .memo-list {
  display: none;
}
.team-memo-board .team-memo-card {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
  border: 3px solid #b0bac9;
  border-radius: 16px;
  align-items: flex-start;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.team-memo-board .team-memo-card.memo-new {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}
.team-memo-board .team-memo-card.memo-read {
  opacity: 0.85;
}
.team-memo-board .memo-body {
  flex: 1 1 320px;
}
.team-memo-board .memo-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.team-memo-board .memo-meta {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.65);
}
.team-memo-board .memo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.team-memo-board .memo-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.team-memo-card.memo-info {
  border-color: #818cf8;
  background: #eef2ff;
  color: #1e3a8a;
}
.team-memo-card.memo-success {
  border-color: #34d399;
  background: #ecfdf5;
  color: #065f46;
}
.team-memo-card.memo-warning {
  border-color: #f59e0b;
  background: #fef3c7;
  color: #92400e;
}
.team-memo-card.memo-danger {
  border-color: #f87171;
  background: #fee2e2;
  color: #991b1b;
}
.team-memo-card.memo-note {
  border-color: #a78bfa;
  background: #f3e8ff;
  color: #6b21a8;
}
.team-memo-card.memo-read .memo-pill {
  opacity: 0.7;
}
.team-memo-board .memo-list:empty {
  display: none;
}
@media (max-width: 768px) {
  .team-memo-board {
    margin: 12px;
    padding: 14px;
  }
  .team-memo-board .memo-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .team-memo-board .team-memo-card {
    flex-direction: column;
  }
}

/* Messages admin page */
.memo-admin {
  padding: 24px;
}
.memo-admin-header {
  margin-bottom: 18px;
}
.memo-admin-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}
.memo-hub-card {
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--br);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 12px 32px rgba(15,23,42,.08);
}
.memo-composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.memo-composer select {
  width: 200px;
  max-width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
}
.memo-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.memo-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.memo-editor-toolbar .memo-editor-hint {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  align-self: center;
}
.memo-editor-toolbar button {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 600;
  cursor: pointer;
}
.memo-editor-toolbar button:hover {
  background: #f3f4f6;
}
.memo-editor {
  min-height: 160px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  line-height: 1.5;
  font: inherit;
  overflow-y: auto;
}
.memo-editor:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}
.memo-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}
.memo-editor img,
.memo-text img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 8px 0;
}
.memo-text {
  white-space: normal;
}
.memo-text .memo-thumb {
  display: inline-flex;
  width: var(--memo-thumb-size, 200px);
  height: var(--memo-thumb-size, 200px);
  border: 1px dashed #cbd5f5;
  background: #f8fafc;
  border-radius: 14px;
  margin: 8px 12px 8px 0;
  padding: 3px;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  transition: transform 120ms ease, box-shadow 120ms ease;
  color: inherit;
  font: inherit;
  line-height: 0;
}
.memo-thumb:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}
.memo-thumb:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.memo-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  margin: 0;
}
.memo-thumb + .memo-thumb {
  margin-left: 0;
}

.memo-image-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 6000;
}
.memo-image-viewer.active {
  display: flex;
}
.memo-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
}
.memo-image-frame {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.memo-image-frame img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.45);
  background: #fff;
}
.memo-image-close {
  position: absolute;
  top: -16px;
  right: -16px;
  border: none;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.memo-image-caption {
  color: #f8fafc;
  font-size: 14px;
  text-align: center;
  max-width: 80vw;
  word-break: break-word;
}
body.memo-image-open {
  overflow: hidden;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.memo-page-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.memo-page-item {
  border-radius: 18px;
  border-width: 3px;
  border-style: solid;
  padding: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform 150ms ease, box-shadow 150ms ease;
  border-color: #b0bac9;
  cursor: grab;
}
.memo-page-item.memo-new {
  border-color: #818cf8;
  box-shadow: 0 16px 32px rgba(79, 70, 229, 0.18);
}
.memo-page-item.memo-read {
  border-color: #b0bac9;
  opacity: 0.9;
}
.memo-page-item.dragging {
  opacity: 0.7;
  cursor: grabbing;
}
.memo-page-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(15, 23, 42, 0.12);
}
.memo-page-item.memo-new .memo-pill {
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.memo-page-item .memo-text {
  font-size: 17px;
  line-height: 1.5;
}
.memo-flag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  margin-bottom: 8px;
}
.memo-flag .flag-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.memo-flag-new {
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: #1e3a8a;
  border-color: #c7d2fe;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}
.memo-flag-new .flag-icon {
  background: radial-gradient(circle at 30% 30%, #fef3c7, #fbbf24);
  color: #7c2d12;
  font-weight: 900;
  animation: memoPulse 1.8s infinite;
}
.memo-flag-read {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.memo-flag-read .flag-icon {
  background: #dcfce7;
  color: #065f46;
  font-weight: 800;
}
.memo-flag-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.memo-unread-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.memo-page-item .memo-actions {
  justify-content: flex-end;
}
.memo-page-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.memo-page-status {
  font-size: 13px;
  color: var(--muted);
}
@media (max-width: 1024px) {
  .memo-hub-card {
    padding: 18px;
  }
  .memo-form-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@keyframes memoPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.85; }
 100% { transform: scale(1); opacity: 1; }
}

/* Extensiv pill */
.pill.extensiv {
  background: #ede9fe;
  border: 2px solid #c4b5fd;
  color: #5b21b6;
}

/* Pastel orange button for Etsy */
.btn.etsy {
  background: #ffedd5;          /* orange-100 */
  border-color: #fdba74;        /* orange-300 */
  color: #7c2d12;               /* orange-900 */
}
.btn.etsy:hover {
  filter: brightness(0.98);
  box-shadow: 0 4px 10px rgba(251, 146, 60, .25);
}


/* Etsy pull button: add logo and make pastel green */
a[href="etsy_pull.php"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #dcfce7;      /* green-100 */
  border: 2px solid #86efac;/* green-300 */
  color: #065f46;           /* green-900 */
  border-radius: 5px;
  font-weight: 700;
}
a[href="etsy_pull.php"]:hover { filter: brightness(0.98); }
a[href="etsy_pull.php"]::before {
  content: '';
  display: inline-block;
  width: 24px; height: 24px;
  background: url('icons/etsy.png') no-repeat center/contain;
}



/* Filters */
.filters { display: flex; flex-direction: column; gap: 10px; }
.filters .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Upload tracking (CSV) */
.upload.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.file-picker.pretty {
  width: 100%;
  max-width: 420px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 10px;
}
#tracking_file { display: none; }
.file-name { font-size: 12px; color: var(--muted); text-align: center; width: 100%; }

/* Table */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--br);
  border-radius: var(--radius);
  padding: 8px;
}
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.table-scroll {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--br);
}
.table-scroll::-webkit-scrollbar { width: 14px; }
.table-scroll::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 7px; }
.table-scroll::-webkit-scrollbar-thumb { background: #b0b8c4; border-radius: 7px; border: 2px solid #f0f0f0; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #8a94a2; }
.table { width: 100%; border-collapse: collapse; border-spacing: 0; }
.table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--br);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
  font-weight: 800;
  z-index: 10;
}
.table tbody td { padding: 8px; border-bottom: 1px solid var(--br); vertical-align: middle; }
.table thead th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table thead th.sortable:hover { background: #eef2ff; }
.table thead th .sort-arrow { display: inline-block; margin-left: 6px; vertical-align: middle; line-height: 1; }
.table thead th .sort-arrow:empty { width: 0; margin: 0; }
#tbl thead th:first-child img { transition: opacity .15s ease; }
#tbl thead th:first-child:hover img { opacity: .7; }
#tbl th.tooted-col, #tbl td.tooted-col { width: 430px; }
/* Keep address column tight to prevent drift and keep icons close */
#tbl th.addr-col, #tbl td.addr { width: 260px; }
th.total, td.total { width: 90px; white-space: nowrap; text-align: right; }
.cell-total strong { font-weight: 700; }
.shop-col, .shop-cell { text-align: center; }
.sum-col { white-space: nowrap; text-align: center; }
.ship-col, .status-col, .date-col, .due-col { text-align: center; }
#thShop .mp-focus { font-weight: 600; margin-left: 4px; }

/* Items in row */
.item { display: flex; gap: 8px; align-items: center; }
.item .muted .qtywrap { white-space: nowrap; }
.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--br);
  background: #f3f4f6;
  display: block;
}
.product img { width: 64px; height: 64px; object-fit: cover; margin-right: 4px; }
.product .price { font-weight: bold; }

/* Tag toggles + tracking */
.tag-toggle { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.tagBtn { border-radius: 10px; line-height: 1; }
.tagBtn.active-regular { border-color: #86efac; background: #dcfce7; }
.tagBtn.active-registered { border-color: #93c5fd; background: #dbeafe; }
.trackbox {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.trackInput {
  display: block;
  width: 100% !important;
  max-width: 220px;
  min-width: 120px;
  box-sizing: border-box;
  padding: 6px 10px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  transition: width .18s ease, background .15s, border-color .15s;
}
.trackInput.has-value { border-color: #c7d2fe; background: #eef2ff; }
.trackInput.track-ok, .trackInput.ok { background: #ecfdf5; border-color: #a7f3d0; }

/* Separators */
.day-sep { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.day-sep .line { flex: 1; height: 1px; background: var(--br); }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: 12px;
  color: var(--txt);
  white-space: nowrap;
  border: 2px solid rgba(0,0,0,.06);
}

/* Tag color coding (used in archived view) */
.pill.tag-regular {
  background: #ecfdf5;      /* green-50 */
  border-color: #86efac;    /* green-300 */
  color: #065f46;           /* green-800 */
}
.pill.tag-registered {
  background: #fee2e2;      /* red-100 */
  border-color: #fecaca;    /* red-200 */
  color: #991b1b;           /* red-800 */
}
.pill.tag-unset {
  background: #f3f4f6;      /* gray-100 */
  border-color: #e5e7eb;    /* gray-200 */
  color: #374151;           /* gray-700 */
}

/* Country filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 3px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .06s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip.active {
  border-color: #1d4ed8 !important;
  border-width: 3px !important;
  box-shadow: 0 0 0 2px rgba(29,78,216,.25);
}
.chip.all-countries {
  background-color: #d2f5d2;
  border: 1px solid #6aa36a;
  color: #063d06;
  font-weight: 500;
}
.chip.all-countries.active { border: 2px solid #000; }

.tag-icon-btn {
  padding:6px;
  min-width:32px;
  height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.tag-icon-btn img {
  width:16px;
  height:16px;
  display:block;
}
/* MASS ACTION (bulk) */
.bulk-wrap { display: flex; flex-direction: column; gap: 8px; }
.bulk-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tagBtnBulk {
  border: 2px solid #e5e7eb;
  background: #fff;
  color: var(--txt);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.tagBtnBulk.active-regular { border-color: #86efac; background: #dcfce7; }
.tagBtnBulk.active-registered { border-color: #93c5fd; background: #dbeafe; }
.tagBtnBulk.active-unset { border-color: #e5e7eb; background: #f9fafb; }

/* Settings ā€“ country color + carrier */
.settings-block { display: flex; flex-direction: column; gap: 10px; }
.cc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow: auto;
  border: 1px dashed var(--br);
  border-radius: 10px;
  padding: 8px;
  background: #fafafa;
}
.cc-row {
  display: grid;
  grid-template-columns: 80px 1fr 160px 1fr auto auto 24px;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border: 1px dashed transparent;
  border-radius: 10px;
}
.cc-row:hover { background: #f9fafb; border-color: #e5e7eb; }
.cc-row.add { margin-top: 6px; }
.cc-code.input, .cc-name.input, .cc-carrier.input { height: 36px; }
.cc-color { width: 90px; height: 36px; border: none; background: transparent; padding: 0; }
.cc-swatch { width: 22px; height: 22px; border-radius: 50%; }
.cc-row .btn.small { padding: 6px 10px; border-radius: 8px; }

/* Responsive */
@media (max-width: 1020px) {
  .page-grid { grid-template-columns: 1fr; }
  .table-scroll { max-height: unset; }
  .cc-row { grid-template-columns: 70px 1fr 90px 1fr auto auto 20px; }
  /* On desktop, .table-wrap is position:absolute inside a full-height grid column.
     On mobile the column has no fixed height, so the parent collapses to 0 and
     the absolute child is invisible. Reset to normal flow. */
  .page-grid:not(.tracking-page) > main.panel > .table-wrap {
    position: static;
  }
  /* On desktop table-scroll uses flex:1 to fill an absolutely-positioned container.
     On mobile there is no container height to grow into, so flex:1 + min-height:0
     collapses it to 0 on real mobile browsers. Let it size to its content instead. */
  .page-grid:not(.tracking-page) > main.panel > .table-wrap > .table-scroll {
    flex: none;
    min-height: unset;
  }
  /* Compact thumbnail column on mobile: show thumb only, hide text */
  #tbl th.tooted-col, #tbl td.tooted-col { width: 68px; }
  #tbl td.tooted-col .item { flex-direction: column; gap: 0; margin-bottom: 2px; }
  #tbl td.tooted-col .item > div { display: none; }
  #tbl td.tooted-col .thumb { width: 56px !important; height: 56px !important; margin-right: 0 !important; }
}
@media (max-width: 768px) {
  .cc-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
  }
  .cc-row input { min-width: 0 !important; max-width: 100%; flex: 1 1 40%; box-sizing: border-box; }
  .cc-row .cc-url.input { flex: 1 1 100%; }
}
@media (max-width: 900px) { th.total, td.total { width: 80px; } }
@media (max-width: 640px) {
  .actions-row { gap: 8px; }
  .btn.cta { width: 100%; max-width: 420px; }
}

/* Actions row */
.actions-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.actions-row .btn { padding: 6px 10px; }

/* Alerts (closable notices for import results) */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--br);
  border-radius: 8px;
  font-weight: 700;
}
.alert.success {
  background: #dcfce7;   /* green-100 */
  border-color: #86efac; /* green-300 */
  color: #065f46;        /* green-800 */
}
.alert .close {
  margin-left: 2px;
  line-height: 1;
  font-weight: 900;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0 6px;
}

/* Address formatting */
.addr { max-width: 260px; white-space: pre-line; font-size: 13px; line-height: 1.25; }
.addr .l1, .addr .l2 { display: block; white-space: normal; word-break: break-word; }
.addr .l1 { font-weight: 600; }
.addr .l2 { color: var(--muted); }
.order-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.order-link.muted { opacity: .75; }

/* Quantity highlight */
.qty-high { color: #ef4444; font-weight: 800; }

/* Notes */
.notes {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f9fafb;
  border: 1px solid var(--br);
  border-radius: 8px;
}
.notes .buyer-note { margin-bottom: 4px; }
.notes .buyer-note strong, .notes .seller-note strong { font-weight: 800; }
.notes-row td { padding-top: 6px; padding-bottom: 6px; background: transparent; border-top: none !important; }
.notes-row .cmt-wrap { transition: background .15s ease; }
.notes-row .cmt-wrap.order-hover, .notes-row .cmt-wrap.order-selected { background: #eaf3ff; }
.cmt-wrap { padding-left: 24px; display: grid; gap: 8px; }
.cmt {
  margin: 6px 0;
  padding: 6px 10px;
  background: #d2ebd6;
  border: 1px solid #73977f;
  border-radius: 4px;
  position: relative;
  display: inline-block;
  max-width: 90%;
  word-break: break-word;
}
.cmt::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 20px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid #73977f;
}
.cmt-seller {
  background: #ffe5e5;
  border: 1px solid #410312;
  margin-top: 0px;
}
.cmt-seller::before { border-bottom-color: #410312; }
.cmt-combined { background: #f0fdf4; border: 1px solid #86efac; }
.cmt-combined::before { border-bottom-color: #86efac; }
.cmt-combined .cmt-section { padding: 2px 0; }
.cmt-combined .cmt-title { font-weight: 800; }
.cmt-combined .cmt-title.seller { color: #991b1b; }
.cmt.cmt-combined-seller { background: #fecaca !important; border-color: #f87171 !important; }
.cmt.cmt-combined-seller::before { border-bottom-color: #f87171 !important; }

/* Order notes */
.order-notes {
  margin-top: 6px;
  background: #fff9db;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
  color: #6b6000;
  position: relative;
}
.order-notes::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 10px;
  width: 14px;
  height: 14px;
  border-left: 2px solid #f59e0b;
  border-bottom: 2px solid #f59e0b;
  border-bottom-left-radius: 6px;
  transform: rotate(45deg);
  background: transparent;
}
.notes-card {
  position: relative;
  margin: 6px 8px 10px 54px;
  padding: 8px 10px;
  background: #fffbe6;
  border: 1px solid #facc15;
  border-radius: 10px;
  color: var(--txt);
}
.notes-card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 16px;
  width: 14px;
  height: 14px;
  border-top: 2px solid #facc15;
  border-left: 2px solid #facc15;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fffbe6 50%, transparent 50%);
}
.notes-card .buyer-note, .notes-card .seller-note { margin: 2px 0; }
.notes-card .seller-note { color: #4b5563; }

/* Due dates */
.due span { color: var(--txt); }
.due.warn span { color: #ef4444; font-weight: 700; }
.due.over span { color: #ef4444; font-weight: 800; }
.due-note { color: #ef4444; font-weight: 800; margin-top: 2px; }

/* Sort line */
.sort-line { display: flex; align-items: center; gap: 8px; }
.sort-line label { margin: 0; }

/* Shipping method */
.ship-method {
  display: inline-block;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  background: #f3f4f6;
}
.ship-method.warn {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}
.ship-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}
.ship-pill.green { background: #ecfdf5; color: #065f46; }
.ship-pill.red { background: #fee2e2; color: #991b1b; }

/* Marketplace filter */
#marketplaceFilter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
#marketplaceFilter .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  line-height: 1;
  border-radius: 16px;
  white-space: nowrap;
  cursor: pointer;
  margin: 2px 5px 2px 0;
}
#marketplaceFilter .chip img.mp32 {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: block;
}
#marketplaceFilter .chip .icon-spacer { width: 18px; height: 18px; display: block; }

/* Shop column */
.shop-col { width: 60px; text-align: center; }
.shop-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.shop-cell .mp32 { width: 32px; height: 32px; border-radius: 6px; }
.shop-cell .ph { width: 32px; height: 32px; background: #e5e7eb; border-radius: 6px; }
.shop-cell .import-time { margin-top: 2px; font-size: 11px; color: #6b7280; }
.shop-cell.shop-stack { gap: 6px; }
.badge-new {
  padding: 2px 8px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  color: #1f2937;
  background: #fde68a;
  border: 2px solid #f59e0b;
  border-radius: 999px;
}
.imported-when { font-size: 10px; color: #6b7280; line-height: 1.1; }

/* Order counter */
.order-counter {
  display: block;
  margin: 0 auto;
  width: fit-content;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
  min-width: 60px;
  text-align: center;
}
.order-counter span { font-variant-numeric: tabular-nums; }
.panel-sticky-top {
  flex-shrink: 0;
  padding: 12px 12px 16px;
  border-bottom: 1px solid var(--br);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.panel-sticky-top .panel-header { margin-top: 12px; }
.panel-selected {
  margin: 8px 0 0;
  font-size: 1.3em;
  font-weight: 700;
  color: #1a2b4a;
  text-align: center;
}
.panel-selected span { font-size: 1.4em; }

/* Row highlights */
tr.order-row.order-hover > td, tr.notes-row.order-hover > td { background: #f7fbff !important; }
tr.order-row.order-selected > td, tr.notes-row.order-selected > td { background: #eaf3ff !important; }
tr.order-row.order-selected td:first-child, tr.notes-row.order-selected td:first-child { box-shadow: inset 3px 0 0 0 #9cbbee; }
tr.order-row.is-new { background: #fffef4; }
tr.order-row.is-new:hover { background: #fff9cc; }
tr.order-row.order-new > td { background: #fff8e6; }
tr.order-row.order-focus > td,
tr.notes-row.order-focus > td {
  animation: order-focus-glow 1.2s ease-in-out 2;
  background: #f0f9ff !important;
  position: relative;
}
tr.order-row.order-focus > td:first-child,
tr.notes-row.order-focus > td:first-child {
  box-shadow: inset 3px 0 0 0 #38bdf8;
}
@keyframes order-focus-glow {
  0%   { box-shadow: inset 0 0 0 0 rgba(56,189,248,0.0); }
  50%  { box-shadow: inset 0 0 0 999px rgba(56,189,248,0.12); }
  100% { box-shadow: inset 0 0 0 0 rgba(56,189,248,0.0); }
}
tr.order-row.order-returned:not(.order-selected) > td,
tr.notes-row.order-returned:not(.order-selected) > td {
  background: #f3e8ff;
  color: #3b0764;
}
tr.order-row.order-returned:not(.order-selected) > td:first-child,
tr.notes-row.order-returned:not(.order-selected) > td:first-child {
  box-shadow: inset 4px 0 0 0 #a855f7;
}
tr.order-row.order-manual:not(.order-selected) > td,
tr.notes-row.order-manual:not(.order-selected) > td {
  background: #c7f7e2;
  border-bottom: 1px solid #6ee7b7;
}
tr.order-row.order-manual:not(.order-selected) > td:first-child,
tr.notes-row.order-manual:not(.order-selected) > td:first-child {
  box-shadow: inset 4px 0 0 0 #10b981;
}
.returned-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 26px 4px 8px;
  border-radius: 8px;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
  position: relative;
  white-space: nowrap;
}
.returned-pill .pill-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #5b21b6;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  transition: opacity .15s ease;
}
.returned-pill:hover .pill-remove {
  opacity: 1;
}
.returned-pill .pill-remove:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 1px;
}

.order-row:hover + .notes-row > td, .order-row.selected + .notes-row > td { background: #f0f6ff; }
/* Address cell line spacing ā€“ no blank lines */
td.addr .addr-line {
  display: block;
  margin: 0;           /* remove any default or inherited margins */
  padding: 0;
  line-height: 1.25;   /* compact but readable */
}
td.addr .addr-line + .addr-line {
  margin-top: 2px;     /* tiny spacing between lines */
}

/* (Optional) If your notes row was causing grey gaps, keep it tight */
tr.notes-row td {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}
/* Due date pill ā€“ base */
.due {
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
  background:#eef2ff;            /* light indigo base */
  color:#1e293b;                  /* slate-800 */
  border:2px solid #c7d2fe;       /* indigo-200 */
  line-height:1;
}
.due > span { display:inline-block; vertical-align:middle; }

/* Soon (yellow) */
.due.warn {
  background:#fef9c3;            /* yellow-100 */
  border-color:#cd9e07;          /* yellow-300 */
  color:#000000;                       /* amber-900 */
}

/* Overdue (red) */
.due.over {
  background:#fee2e2;            /* red-100 */
  border-color:#fecaca;          /* red-200 */
  color:#7f1d1d;                 /* red-900 */
}

/* Optional small helper text under the date (used for "MĆ¶Ć¶das") */
.due .due-note {
  display:block;
  margin-top:2px;
  font-size:11px;
  font-weight:600;
  opacity:.9;
}


/* Pastel green export button */
#exportCsv.btn {
  --bg: #a8e6cf;         /* pastel green */
  --bg-hover: #9adfc4;   /* a bit darker on hover */
  --bg-active: #87d6b6;  /* pressed */
  --border: #7cc9ab;     /* outline color */
  --text: #0e3b31;       /* dark green text */

  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg), #a2e2cb);
  color: var(--text);
  border-radius: 5px;            /* rectangle with soft corners */
  padding: 10px 16px;
  font: 600 14px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.06) inset;
  transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

#exportCsv.btn:hover {
  background: linear-gradient(180deg, var(--bg-hover), #95dbc2);
  box-shadow: 0 2px 10px rgba(0,0,0,0.10) inset, 0 2px 8px rgba(0,0,0,0.10);
}

#exportCsv.btn:active {
  background: var(--bg-active);
  transform: translateY(1px);
  box-shadow: 0 0 0 rgba(0,0,0,0.0) inset, 0 1px 4px rgba(0,0,0,0.12);
}

#exportCsv.btn:focus-visible {
  outline: 3px solid rgba(124, 201, 171, 0.65); /* soft green focus ring */
  outline-offset: 2px;
}

/* Respect reduced motion settings */
@media (prefers-reduced-motion: reduce) {
  #exportCsv.btn {
    transition: none;
  }
}

/* Address warning */
td.addr.warn {

  border: 3px solid #ef4444;/* red-500 */
}


/* Phone line niceties */
.phone-line { white-space: nowrap; }
.phone-line .phone-edit { color: #6b7280; }               /* gray-500 */
.phone-line .phone-edit:hover { color: #111827; }         /* gray-900 */
.phone-line.empty em { color: #9ca3af; }                  /* gray-400 */

/* Base wrapper that already exists around the address */
.addr-box {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
}

/* SOFT: amber dashed border */
.addr-box.addr-soft {
  border-color: #f59e0b;
  border-style: dashed;
}

/* HARD: solid red border */
.addr-box.addr-hard {
  border-color: #ef4444;
  border-style: solid;
}

/* Small note line under address */
.addr-box .addr-flag {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;          /* neutral text */
}
.addr-box.addr-hard .addr-flag { color: #7f1d1d; } /* darker red for emphasis */
/* ---- Address warnings: border only, no background ---- */
td.addr { position: relative; }
td.addr.addr-soft {
  outline: 2px dashed #f59e0b;      /* amber dashed */
  outline-offset: 2px;
  border-radius: 8px;
}
td.addr.addr-warn {
  outline: 2px solid #ef4444;       /* red solid */
  outline-offset: 2px;
  border-radius: 8px;
}
td.addr .addr-flag {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}
td.addr.addr-warn .addr-flag { color: #7f1d1d; }

/* ---- Phone editor inside the address cell ---- */
.addr .phone-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.addr .phone-label {
  font-size: 12px;
  color: #6b7280;
}
.addr .phone-value {
  font-weight: 600;
}
.addr .phone-edit-btn {
  border: none;
  background: none;
  cursor: pointer;
  opacity: .7;
  padding: 2px;
  line-height: 0;
}
.addr .phone-edit-btn:hover { opacity: 1; }

.addr .phone-edit-wrap {
  display: none;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}
.addr .phone-edit-wrap.active { display: flex; }

.addr .phone-input {
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-width: 180px;
}

.addr .btn-plain {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}
.addr .btn-plain.save { border-color: #86efac; }
.addr .btn-plain.cancel { border-color: #fecaca; }

.addr-lbl {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #374151;
}
.addr-inp {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
}
.addr-inp:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(147,197,253,.35);
}


/* Make the address cell a positioning context */
td.addr { position: relative; }

/* Fading success pill */
.flash-msg {
  position: absolute;
  top: 6px;
  right: 34px;          /* leaves room for your āˇ button on the far right */
  background: #dcfce7;  /* green-100 */
  border: 1px solid #86efac; /* green-300 */
  color: #065f46;       /* green-800 */
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  animation: flashInOut 2.2s ease-out forwards;
  z-index: 6;           /* above the address content and edit button */
}

@keyframes flashInOut {
  0%   { opacity: 0; transform: translateY(-6px); }
  10%  { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* Make sure the address cell can host the overlay border */
td.addr { position: relative; }

/* Success flash: a green outline that fades out */
td.addr.addr-flash-green::after {
  content: "";
  position: absolute;
  inset: -2px;                /* slightly outside the cell */
  border: 2px solid #10b981;  /* emerald-500 */
  border-radius: 8px;         /* matches your rounded look; tweak if needed */
  pointer-events: none;
  opacity: 0;
  animation: addrFlashGreen 3s ease-out forwards;
  z-index: 6;                 /* above cell contents & pencil button */
}

@keyframes addrFlashGreen {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
/* 1) Make header reliably on top of scrolling rows */
#tbl thead th {
  position: sticky;       /* you probably already have this */
  top: 0;
  z-index: 10;            /* below topbar (z=20), above rows */
  background: #eef2ff;    /* solid bg so rows don't show through */
}

/* 2) Ensure address cell UI doesn't outrank the header */
td.addr { position: relative; z-index: 0; }
td.addr .addr-view { position: relative; z-index: 0; }
td.addr .addr-edit-wrap { position: relative; z-index: 0; }
td.addr .addr-flag { position: relative; z-index: 0; }

/* The pencil stays clickable but below the header */
td.addr .addr-edit-btn { position: absolute; z-index: 1; }

/* If you added a green flash class earlier, keep it inside the cell */
td.addr.addr-flash-green {
  animation: addrFlashGreenCell 1.2s ease-out forwards;
  box-shadow: inset 0 0 0 2px #10b981;
}
@keyframes addrFlashGreenCell {
  0%   { box-shadow: inset 0 0 0 2px #10b981; }
  70%  { box-shadow: inset 0 0 0 2px rgba(16,185,129,.8); }
  100% { box-shadow: inset 0 0 0 0 rgba(16,185,129,0); }
}

/* Optional: if you use sticky <thead> row, ensure the whole row sits on top */
#tbl thead tr { z-index: 10; }

/* Temporary border while the address editor is open */
td.addr.addr-editing {
  outline: 2px solid #ef4444;   /* red edit border */
  outline-offset: -2px;
}

/* Pastel yellow button - "Rakenda MĆ¤rgise Reeglid" */
#applyTagRules.btn {
  --y0: #fff9cf;   /* light pastel */
  --y1: #ffef9a;   /* mid pastel */
  --y2: #ffe16a;   /* hover deepen */
  --yBorder: #e3c454;
  --yText: #3a2e06;

  border-radius: 6px;
  border: 1px solid var(--yBorder);
  background: linear-gradient(180deg, var(--y0), var(--y1));
  color: var(--yText);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), inset 0 2px 8px rgba(0,0,0,.05);
  transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

#applyTagRules.btn:hover {
  background: linear-gradient(180deg, var(--y1), var(--y2));
  box-shadow: 0 2px 10px rgba(0,0,0,.10) inset, 0 2px 8px rgba(0,0,0,.08);
}

#applyTagRules.btn:active {
  transform: translateY(1px);
  background: var(--y2);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.12);
}

#applyTagRules.btn:focus-visible {
  outline: 3px solid rgba(253, 224, 71, .65); /* soft yellow focus ring */
  outline-offset: 2px;
}

#applyTagRules.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}



/* Anchor overlay on each cell */
tr.order-row.editing-highlight > td,
tr.notes-row.editing-highlight > td {
  position: relative;
}

/* Green overlay that sits ABOVE any blue selection background */
tr.order-row.editing-highlight > td::after,
tr.notes-row.editing-highlight > td::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(16, 185, 129, 0.20); /* pastel green */
  z-index: 3;                             /* <-- key! above selection */
  opacity: 1;
  transition: opacity .6s ease;
  border-radius: 2px;
}

/* Fade away after save/cancel */
tr.order-row.editing-fade > td::after,
tr.notes-row.editing-fade > td::after {
  opacity: 0;
}

/* --- Left stripes: use inset box-shadow for both states --- */

/* 1) Remove any legacy left borders that push layout */
tr.order-row.order-new > td:first-child,
tr.order-row.is-new > td:first-child {
  border-left: 0 !important;
}

/* 2) NEW (yellow) stripe ā€“ inset, no layout shift */
tr.order-row.order-new > td:first-child,
tr.order-row.is-new > td:first-child {
  box-shadow: inset 3px 0 0 0 #fbbf24; /* amber-400 */
}

/* 3) SELECTED (blue) stripe ā€“ takes priority over yellow */
tr.order-row.order-selected > td:first-child {
  box-shadow: inset 3px 0 0 0 #9cbbee !important; /* blue-ish */
}


/* Make 'new' stripe appear on notes rows as well */
tr.notes-row.order-new > td:first-child {
  box-shadow: inset 3px 0 0 0 #fbbf24; /* amber-400 */
}

/* Ensure selected (blue) overrides yellow on notes rows */
tr.notes-row.order-selected > td:first-child {
  box-shadow: inset 3px 0 0 0 #9cbbee !important;
}

/* NEW: give notes row the same 'new' background */
tr.notes-row.order-new > td {
  background: #fff8e6 !important; /* amber-ish like the main row */
}

/* Keep blue selection/hover on top of yellow */
tr.notes-row.order-selected > td,
tr.notes-row.order-hover > td {
  background: #eaf3ff !important;
}

.manual-edit-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fdf2f8;
  border: 1px solid #f9a8d4;
  color: #9d174d;
  margin-top: 6px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.manual-edit-flag-inline {
  margin-top: 4px;
  margin-left: 0;
}
.manual-edit-flag:focus-visible {
  outline: 2px solid #f472b6;
  outline-offset: 2px;
}
.addr-items-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.addr-items-head {
  font-weight: 700;
}
.addr-items-list {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}
.addr-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}
.addr-total-row-value {
  font-weight: 700;
}
.manual-sku-block {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #f9fafb;
}
.manual-sku-field,
.manual-sku-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}
.manual-sku-inline-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.manual-sku-suggest {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 8px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
}
.manual-sku-suggest.hidden {
  display: none;
}
.manual-sku-suggest-item {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
  text-align: left;
}
.manual-sku-suggest-item:hover {
  background: #f3f4f6;
}
.manual-sku-suggest-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.manual-sku-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.manual-log-holder {
  margin-top: 12px;
}
.manual-log-block {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.manual-log-entry {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.manual-log-entry:last-child {
  margin-bottom: 0;
}
.manual-log-meta {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.manual-log-list ul {
  margin: 0;
  padding-left: 18px;
  color: #111827;
}
.manual-log-popup {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.manual-log-popup.hidden {
  display: none;
}
.manual-log-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}
.manual-log-popup-box {
  position: relative;
  z-index: 1;
  width: min(520px, 90vw);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  box-shadow: 0 25px 45px rgba(15, 23, 42, 0.25);
  overflow-y: auto;
}
.manual-log-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.manual-log-popup-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}
.manual-log-popup-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
}
.manual-log-popup-content .manual-log-title {
  display: none;
}
.manual-log-popup-content .manual-log-block {
  border: 0;
  padding: 0;
}
.manual-item-row {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 48px 10px 10px;
  margin-bottom: 8px;
  background: #fff;
  position: relative;
  min-height: 64px;
}
.manual-item-row:last-child {
  margin-bottom: 0;
}
.manual-item-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #f87171;
  background: #fee2e2;
  color: #7f1d1d;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.manual-item-remove-btn:hover {
  background: #fecaca;
  border-color: #f87171;
  color: #991b1b;
}

.manual-sku-suggest-empty {
  padding: 8px;
  font-size: 12px;
  color: #6b7280;
}

/* Return modal */
.return-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
  transition: opacity .2s ease;
}
.return-modal.hidden {
  opacity: 0;
  pointer-events: none;
}
.return-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.return-modal-box {
  position: relative;
  z-index: 1;
  width: min(420px, 90vw);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 24px;
  box-shadow: 0 25px 40px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.return-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.return-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}
.return-modal-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
}
.return-modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.return-modal-error {
  color: #b91c1c;
  font-size: 13px;
}
.return-modal-error.hidden {
  display: none;
}
.return-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.linked-col { width:34px; }
.linked-cell {
  text-align:center;
  vertical-align:middle;
}
.link-btn {
  width:32px;
  height:32px;
  border-radius:999px;
  border:1px solid rgba(99,102,241,.4);
  background:linear-gradient(135deg, #eef2ff, #e0e7ff);
  box-shadow:0 3px 8px rgba(15,23,42,.18);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  padding:0;
}
.link-btn img {
  width:18px;
  height:18px;
  display:block;
}
.link-btn:hover {
  transform:translateY(-1px);
  box-shadow:0 6px 14px rgba(15,23,42,.25);
  border-color:#6366f1;
}
.link-btn.is-linked {
  background:linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-color:#818cf8;
}
.link-drawer {
  position:fixed;
  inset:0;
  display:none;
  z-index:1200;
}
.link-drawer.active { display:block; }
.link-drawer-overlay {
  position:absolute;
  inset:0;
  background:rgba(15,23,42,0.4);
}
.link-drawer-panel {
  position:absolute;
  top:0;
  right:0;
  width:420px;
  max-width:100%;
  height:100%;
  background:#fff;
  box-shadow:-6px 0 20px rgba(15,23,42,0.25);
  display:flex;
  flex-direction:column;
}
.link-drawer-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 20px;
  border-bottom:1px solid #e2e8f0;
}
.link-drawer-title { font-size:18px; font-weight:700; color:#0f172a; }
.link-drawer-close {
  border:none;
  background:none;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  color:#475569;
}
.link-drawer-body {
  flex:1;
  overflow-y:auto;
  padding:18px 20px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.link-current-card,
.link-preview-card {
  border:1px solid #e2e8f0;
  border-radius:12px;
  padding:12px;
  background:#f8fafc;
}
.link-preview-card.empty {
  border-style:dashed;
  color:#94a3b8;
  background:#fff;
  text-align:center;
  font-size:13px;
}
.link-chain-list {
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.link-chain-item {
  list-style:none;
  border:1px solid #e2e8f0;
  border-radius:10px;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  background:#fff;
  box-shadow:0 1px 4px rgba(15,23,42,.08);
}
.link-chain-item.is-current { border-color:#0ea5e9; background:#f0f9ff; }
.link-chain-head {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
.link-chain-remove {
  background:#fff;
  border:1px solid transparent;
  border-radius:999px;
  width:30px;
  height:30px;
  font-size:20px;
  line-height:1;
  color:#dc2626;
  cursor:pointer;
  transition:all .2s ease;
  box-shadow:0 1px 4px rgba(15,23,42,.12);
}
.link-chain-remove:hover:not(:disabled) {
  transform:scale(1.05);
  border-color:#fecaca;
  box-shadow:0 4px 10px rgba(248,113,113,.35);
}
.link-chain-remove:disabled {
  opacity:.4;
  cursor:not-allowed;
  box-shadow:none;
}
.link-chain-meta {
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:#475569;
  flex-wrap:wrap;
}
.link-badge {
  display:inline-flex;
  align-items:center;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:600;
  border:1px solid transparent;
}
.link-badge.archived { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.link-badge.returned { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.link-badge.active { background:#ecfccb; color:#365314; border-color:#d9f99d; }
.link-items-grid {
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:8px;
}
.link-item-row {
  display:flex;
  gap:8px;
}
.link-item-thumb {
  width:42px;
  height:42px;
  border-radius:8px;
  border:1px solid #e5e7eb;
  object-fit:cover;
  background:#f1f5f9;
}
.link-memo-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 10px;
  border-radius:10px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
}
.link-memo-text {
  flex:1;
  font-size:14px;
  color:#0f172a;
  line-height:1.4;
}
.link-memo-text.muted {
  color:#94a3b8;
  font-style:italic;
}
.link-memo-edit {
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid #cbd5f5;
  background:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all .2s ease;
  box-shadow:0 1px 4px rgba(15,23,42,.12);
}
.link-memo-edit img {
  width:16px;
  height:16px;
  display:block;
}
.link-memo-edit:hover {
  border-color:#818cf8;
  box-shadow:0 4px 10px rgba(129,140,248,.35);
}
.link-memo-edit:disabled {
  opacity:.45;
  cursor:not-allowed;
  box-shadow:none;
}
.link-memo-form {
  margin-top:8px;
}
.link-memo-form textarea {
  width:100%;
  border-radius:8px;
  border:1px solid #cbd5f5;
  padding:8px;
  font-family:inherit;
  font-size:14px;
  min-height:90px;
  resize:vertical;
  background:#fff;
}
.link-memo-form .link-form-actions {
  justify-content:flex-start;
  gap:10px;
  margin-top:8px;
}
.link-order-anchor {
  color:#1d4ed8;
  text-decoration:none;
}
.link-order-anchor:hover,
.link-order-anchor:focus-visible {
  text-decoration:underline;
}
.link-form {
  display:flex;
  flex-direction:column;
  gap:10px;
}
.link-form input[type="text"],
.link-form textarea {
  width:100%;
  border:1px solid #cbd5f5;
  border-radius:8px;
  padding:8px 10px;
  font-size:14px;
}
.link-form small { font-size:12px; color:#64748b; }
.link-form-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.link-status {
  font-size:13px;
  color:#dc2626;
}
.link-status.ok { color:#16a34a; }
.link-results {
  margin-top:8px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.link-result-btn {
  width:100%;
  text-align:left;
  padding:6px 10px;
  border-radius:8px;
  border:1px solid #cbd5f5;
  background:#fff;
  font-size:13px;
  cursor:pointer;
  color:#0f172a;
}
.link-result-btn:hover {
  border-color:#7dd3fc;
  background:#ecfeff;
}
.link-result-btn.active {
  border-color:#2563eb;
  background:#dbeafe;
}
.link-chain-thumbs {
  margin-top:6px;
  display:flex;
  gap:6px;
}
.link-chain-thumb {
  width:34px;
  height:34px;
  border-radius:8px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
  overflow:hidden;
}
.link-chain-thumb img {
  width:100%;
  height:100%;
  object-fit:cover;
}
.link-chain-thumb .thumb-fallback,
.link-chain-thumb .thumb-fallback::before {
  display:block;
  width:100%;
  height:100%;
  background:#e2e8f0;
  content:'';
}

/* ========== THEME: Autumn Luxe ========== */
[data-theme="autumn"] {
  --bg: #f5f0e8;
  --card: #faf8f4;
  --muted: #7f7265;
  --txt: #3a2e22;
  --br: #c8c0b4;
  --primary: #bf8440;
  --blue: #a06e30;
  --success: #6a8a45;
  --danger: #a63d3d;
  --chip-border: #3a2e22;
}
/* ── Topbar & Nav ── */
[data-theme="autumn"] .topbar {
  background: #3a2e22;
  border-bottom-color: #2a2018;
}
[data-theme="autumn"] .brand .title,
[data-theme="autumn"] .brand a {
  color: #faf8f4 !important;
}
[data-theme="autumn"] .nav-btn {
  background: #4a3e32;
  border-color: #5a4e42;
  color: #ece5da;
}
[data-theme="autumn"] .nav-btn:hover {
  background: #5a4e42;
}
[data-theme="autumn"] .nav-btn.active {
  background: #bf8440;
  border-color: #a06e30;
  color: #fff;
}
[data-theme="autumn"] .nav-dropdown-menu-inner {
  background: #faf8f4;
  border-color: #c8c0b4;
  box-shadow: 0 4px 12px rgba(58,46,34,.15);
}
[data-theme="autumn"] .nav-dropdown-item { color: #3a2e22; }
[data-theme="autumn"] .nav-dropdown-item:hover { background: #efe8dd; }
[data-theme="autumn"] .nav-dropdown-item.active { background: rgba(191,132,64,.15); color: #bf8440; }
[data-theme="autumn"] .hamburger-bar { background: #ece5da; }
@media (max-width: 768px) {
  [data-theme="autumn"] .nav-links { background: #3a2e22; border-color: #2a2018; }
}
/* ── Panels & Cards ── */
[data-theme="autumn"] .panel { background: #faf8f4; border-color: #c8c0b4; }
[data-theme="autumn"] .panel .panel { background: #efe8dd; border-color: #c8c0b4; }
[data-theme="autumn"] .panel-header .sep { background: #c8c0b4; }
[data-theme="autumn"] .card { background: #faf8f4; border-color: #c8c0b4; }
[data-theme="autumn"] .card .card-h { border-bottom-color: #ddd6cc; }
[data-theme="autumn"] .table-wrap { background: #faf8f4; border-color: #c8c0b4; }
[data-theme="autumn"] a { color: #a06e30; }
/* ── Buttons ── */
[data-theme="autumn"] .btn { background: #faf8f4; border-color: #c8c0b4; color: #3a2e22; }
[data-theme="autumn"] .btn:hover { filter: brightness(.97); }
[data-theme="autumn"] .btn.cta { background: #bf8440; border-color: #a06e30; color: #fff; }
[data-theme="autumn"] .btn.cta:hover { background: #a06e30; }
[data-theme="autumn"] .btn.primary { background: #bf8440; border-color: #a06e30; color: #fff; }
[data-theme="autumn"] .btn.primary:hover { background: #a06e30; }
[data-theme="autumn"] .btn.blue { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
[data-theme="autumn"] .btn.success { background: #e8f5d4; border-color: #a3c97a; color: #3a5a1c; }
[data-theme="autumn"] .btn.danger { background: #f9d4d4; border-color: #c57b7b; color: #6b1a1a; }
[data-theme="autumn"] .btn.secondary { background: #efe8dd; border-color: #c8c0b4; color: #3a2e22; }
[data-theme="autumn"] .btn.toggle.active { background: #bf8440; border-color: #a06e30; color: #fff; }
[data-theme="autumn"] .btn.etsy { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
[data-theme="autumn"] .btn.btn-returned { background: #fef3c7; border-color: #e3c454; color: #6b4f10; }
[data-theme="autumn"] .btn.file { background: #fef3c7; border-color: #e3c454; }
/* ── Inputs ── */
[data-theme="autumn"] .input { background: #f0ebe2; border-color: #c8c0b4; }
[data-theme="autumn"] .input:focus { border-color: #bf8440; box-shadow: 0 0 0 3px rgba(191,132,64,.2); }
/* ── Tables ── */
[data-theme="autumn"] .table thead th,
[data-theme="autumn"] #tbl thead th { background: #efe8dd; border-bottom-color: #c8c0b4; }
[data-theme="autumn"] .table thead th.sortable:hover { background: #e5ded3; }
[data-theme="autumn"] .table tbody td { border-bottom-color: #ddd6cc; }
/* ── Chips & Pills ── */
[data-theme="autumn"] .chip.active { border-color: #bf8440 !important; box-shadow: 0 0 0 2px rgba(191,132,64,.25); }
[data-theme="autumn"] .pill { border-color: rgba(58,46,34,.12); }
[data-theme="autumn"] .pill.extensiv { background: #fef3c7; border-color: #e3c454; color: #6b4f10; }
/* ── Returned pill (purple → warm gold in autumn) ── */
[data-theme="autumn"] .returned-pill { background: #fef3c7; border-color: #e3c454; color: #6b4f10; }
[data-theme="autumn"] .returned-pill .pill-remove { color: #6b4f10; }
/* ── Row highlights ── */
[data-theme="autumn"] tr.order-row.order-returned:not(.order-selected) > td,
[data-theme="autumn"] tr.notes-row.order-returned:not(.order-selected) > td {
  background: #fef9e7; color: #3a2e22;
}
[data-theme="autumn"] tr.order-row.order-returned:not(.order-selected) > td:first-child,
[data-theme="autumn"] tr.notes-row.order-returned:not(.order-selected) > td:first-child {
  box-shadow: inset 4px 0 0 0 #bf8440;
}
[data-theme="autumn"] .manual-edit-flag { background: #fef3c7; border-color: #e3c454; color: #6b4f10; }
/* ── Link drawer (purple → autumn warm) ── */
[data-theme="autumn"] .link-btn { background: linear-gradient(135deg,#fef3c7,#fde68a); border-color: rgba(191,132,64,.4); }
[data-theme="autumn"] .link-btn:hover { border-color: #bf8440; box-shadow: 0 6px 14px rgba(58,46,34,.2); }
[data-theme="autumn"] .link-btn.is-linked { background: linear-gradient(135deg,#fde68a,#fcd34d); border-color: #bf8440; }
/* ── Memo ── */
[data-theme="autumn"] .team-memo-board { background: #faf8f4; border-color: #c8c0b4; }
[data-theme="autumn"] .memo-hub-card { background: #faf8f4; border-color: #c8c0b4; }
[data-theme="autumn"] .team-memo-card.memo-info { border-color: #bf8440; background: #fefce8; color: #6b4f10; }
[data-theme="autumn"] .team-memo-card.memo-success { border-color: #6a8a45; background: #f3f8ec; color: #3a5a1c; }
[data-theme="autumn"] .team-memo-card.memo-warning { border-color: #d4920a; background: #fef9e7; color: #78350f; }
[data-theme="autumn"] .team-memo-card.memo-danger { border-color: #c45050; background: #fce8e8; color: #6b1a1a; }
[data-theme="autumn"] .team-memo-card.memo-note { border-color: #a06e30; background: #fef9e7; color: #6b4f10; }
[data-theme="autumn"] .memo-page-item { border-color: #c8c0b4; background: #faf8f4; }
[data-theme="autumn"] .memo-page-item.memo-new { border-color: #bf8440; }
[data-theme="autumn"] .memo-page-item.memo-read { border-color: #c8c0b4; }
[data-theme="autumn"] .memo-top-add { background: #fef3c7; border-color: #e3c454; }
/* ── Disabled states ── */
[data-theme="autumn"] .btn:disabled,
[data-theme="autumn"] .btn[disabled] { opacity: .5; color: #7f7265; }
/* ── Active filter pill (indigo → autumn) ── */
[data-theme="autumn"] .nav-btn .memo-count.has-new { background: #fef3c7; color: #92400e; }
[data-theme="autumn"] .badge-new { background: #fef3c7; border-color: #bf8440; color: #6b4f10; }

/* ===== Tracking page ===== */
.tracking-page { grid-template-columns: 320px 1fr; }
.tracking-stats { display:flex; flex-direction:column; gap:6px; padding:8px 0; }
.tracking-stats .stat-row { display:flex; justify-content:space-between; align-items:center; padding:4px 0; }
.tracking-stats .stat-row span { color:var(--muted); }
.clr-green { color: var(--success); }
.clr-blue { color: var(--blue); }
.clr-muted { color: var(--muted); }

.tracking-section-head { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:var(--radius) var(--radius) 0 0; }
.tracking-section-head h3 { margin:0; font-size:14px; }
.tracking-section-head.green { background:#dcfce7; color:#166534; }
.tracking-section-head.blue { background:#dbeafe; color:#1e40af; }
.tracking-section-head.grey { background:#f3f4f6; color:#374151; }
.section-count { font-weight:700; font-size:13px; }

.trk-pill { display:inline-block; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:700; white-space:nowrap; }
.trk-delivered { background:#dcfce7; color:#166534; border:1px solid #86efac; }
.trk-transit { background:#dbeafe; color:#1e40af; border:1px solid #93c5fd; }
.trk-unchecked { background:#f3f4f6; color:#6b7280; border:1px solid #d1d5db; }

.tracking-page .btn.small { padding:4px 10px; font-size:12px; }
.tracking-page .btn.blue { background:var(--blue); color:#fff; }
.tracking-page .btn.blue:hover { background:#1d4ed8; }

.clr-danger { color: var(--danger); }
.trk-row-stuck { background: #fef2f2; }
.trk-row-stuck td { border-color: #fecaca; }

.trk-progress { font-size:12px; font-weight:600; color:var(--primary); animation: trk-pulse 1.2s ease-in-out infinite; }
@keyframes trk-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.trk-collapse { border-top:1px solid var(--br); padding-top:8px; }
.trk-collapse-btn { display:flex; align-items:center; justify-content:space-between; width:100%; background:none; border:none; cursor:pointer; padding:6px 0; font:inherit; font-weight:700; font-size:13px; color:var(--txt); }
.trk-collapse-btn:hover { color:var(--primary); }
.trk-arrow { font-size:10px; transition:transform .15s; }
.trk-collapse-body { padding:4px 0; }

.trk-add-row { display:flex; gap:4px; align-items:center; margin-top:8px; }
.trk-add-row input { font:inherit; padding:4px 6px; border:1px solid var(--br); border-radius:6px; }

.trk-dropdown { position:absolute; top:100%; left:0; right:0; z-index:50; background:var(--card); border:1px solid var(--br); border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,.12); max-height:180px; overflow-y:auto; }
.trk-dropdown-item { padding:6px 10px; cursor:pointer; font-size:13px; }
.trk-dropdown-item:hover { background:#f3f4f6; }

.trk-shiptable { font-size:12px; border-collapse:collapse; width:100%; }
.trk-shiptable td, .trk-shiptable th { padding:4px 6px; white-space:nowrap; vertical-align:middle; }
.trk-shiptable th { text-align:left; font-size:11px; color:var(--muted); font-weight:600; }
.trk-shiptable tbody tr { border-bottom:1px solid var(--br); }
.trk-nr-cell { text-align:center; font-size:11px; color:var(--muted); }
.trk-days-cell { white-space:nowrap; }
.trk-days-input { width:42px; padding:2px 3px; font-size:12px; border:1px solid var(--br); border-radius:4px; background:var(--bg); color:var(--txt); text-align:center; }
.trk-days-input:focus { border-color:var(--primary); outline:none; }
.trk-days-sep { display:inline-block; width:8px; text-align:center; color:var(--muted); font-size:11px; }
.trk-days-amz { background:var(--bg); border-color:#f59e0b; }
.trk-amz-icon { width:16px; height:16px; vertical-align:middle; margin-right:2px; opacity:.8; }
.trk-avg-cell { text-align:center; font-weight:600; font-size:12px; color:var(--primary); }
.trk-avg-link { color:var(--primary); text-decoration:none; border-bottom:1px dashed var(--primary); cursor:pointer; }
.trk-avg-link:hover { color:var(--blue); border-bottom-color:var(--blue); }
.trk-name-link { color:var(--txt); text-decoration:none; border-bottom:1px dashed var(--br); }
.trk-name-link:hover { color:var(--primary); border-bottom-color:var(--primary); }
.btn-del-shiptime { background:none; border:none; cursor:pointer; color:var(--muted); font-size:14px; padding:0 4px; line-height:1; }
.btn-del-shiptime:hover { color:var(--danger); }
