﻿/* 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;
}

* { 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; }

/* 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; }
.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; }

/* Layout */
.page-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 16px;
  padding: 12px;
}
.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: auto;
  padding-bottom: 12px;
}
.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); }

/* 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.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.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); 
}

/* 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('assets/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);
  max-height: calc(100vh - 190px);
}
.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: var(--chip-border) !important; box-shadow: 0 0 0 2px rgba(30,58,138,.2); }
.chip.all-countries {
  background-color: #d2f5d2;
  border: 1px solid #6aa36a;
  color: #063d06;
  font-weight: 500;
}
.chip.all-countries.active { border: 2px solid #000; }

/* 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; }
}
@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; }

/* 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: inline-block;
  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; }

/* 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; }

.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 */
  text-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: addrFlashGreen 1.2s ease-out forwards;
  box-shadow: inset 0 0 0 2px #10b981;
}
@keyframes addrFlashGreen {
  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;
}


