* { box-sizing: border-box; }
html, body {
  font-family: "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
body {
  color: #1f1f1f;
  margin: 0;
}

a { color: #4F4FEA; }

/* ---- Site header / nav / footer ---- */
.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  border-bottom: 1px solid #ece3d6;
  flex-wrap: wrap;
  font-size: 1.1rem;
}
.site-logo {
  font-weight: 700;
  color: #1f1f1f;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}
.site-nav-link {
  color: #6b6b6b;
  text-decoration: none;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.site-nav-link:hover { color: #1f1f1f; }
.site-nav-link.active {
  color: #4F4FEA;
  border-bottom-color: #4F4FEA;
}
.nav-count {
  color: #b0a99b;
  font-weight: 400;
}
.site-nav-link:hover .nav-count,
.site-nav-link.active .nav-count { color: inherit; }
.profile-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}
.profile-name { color: #1f1f1f; font-weight: 600; text-decoration: none; }
.profile-name:hover { text-decoration: underline; }
.profile-logout { color: #8a8a8a; }
.profile-logout:hover { color: #6b6b6b; }

/* ---- Login page ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #FBF3EA;
}
.auth-card {
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid #ece3d6;
  border-radius: 10px;
  padding: 28px 28px 24px;
}
.auth-card h1 {
  margin: 0 0 20px;
  font-size: 1.125rem;
  text-align: center;
}
.auth-field {
  display: block;
  font-size: 1rem;
  color: #6b6b6b;
  margin-bottom: 14px;
}
.auth-field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #d8d0c2;
  border-radius: 4px;
  padding: 9px 12px;
  font: inherit;
  font-size: 1rem;
}
.auth-field input:focus { outline: none; border-color: #4F4FEA; }
.auth-field-hint { color: #b0a99b; font-size: 0.875rem; }
.auth-submit {
  width: 100%;
  background: #4F4FEA;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.auth-submit:hover { background: #3f3fd0; }
.auth-error {
  background: #fdeaea;
  color: #a3372c;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 1rem;
  margin-bottom: 16px;
}
.import-confirm {
  background: #fff6df;
  color: #6b5a1f;
  border: 1px solid #f0dfa6;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  max-width: 640px;
  margin-top: 16px;
}
.import-confirm a { color: #4F4FEA; }
.auth-note {
  background: #eef0fd;
  color: #3f3fd0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 16px;
}
.auth-footer { color: #b0a99b; font-size: 1rem; }

.site-content { padding: 20px; max-width: 1600px; }

.site-footer {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-top: 1px solid #ece3d6;
  color: #8a8a8a;
  font-size: 1rem;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.top-bar .back-link { font-size: 1rem; }
.meta-badge {
  font-size: 1rem;
  color: #6b6b6b;
  background: #f1ebe0;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.meta-badge.accuracy-high { background: #e6f7ec; color: #1f7a3f; }
.meta-badge.accuracy-mid { background: #fff6df; color: #8a6d1f; }
.meta-badge.accuracy-low { background: #fdeaea; color: #a3372c; }
.meta-badge.status-pending { background: #fff6df; color: #8a6d1f; }
.meta-badge.source-freshdesk { background: #e3f4ea; color: #137a4a; }
.attachments-mark {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin-left: 6px;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  color: #8a6d1f;
  cursor: default;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #fff;
  color: #4F4FEA;
  border: 1px solid #4F4FEA;
  border-radius: 6px;
  cursor: pointer;
}
.icon-btn:hover { background: #f6efe4; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: #FBF3EA;
  border: 1px solid #ece3d6;
  border-radius: 10px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #ece3d6;
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #6b6b6b;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: #1f1f1f; }
.modal-body { padding: 16px 20px; }
.accuracy-chart { display: block; overflow: visible; }

.layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-top: 16px;
}
.left-panel, .right-panel {
  flex: 1 1 50%;
  min-width: 0;
}
.right-panel {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* ---- Order preview card ---- */
.order-card {
  background: #FBF3EA;
  border: 1px solid #ece3d6;
  border-radius: 10px;
  overflow: hidden;
  font-size: 1rem;
}

.order-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #ece3d6;
}
.order-header .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ddd6c8;
  flex-shrink: 0;
}
.order-header .title {
  font-weight: 600;
  font-size: 1rem;
}
.order-header .subtitle {
  font-size: 1rem;
  color: #8a8a8a;
  margin-top: 2px;
}
.placeholder-text {
  color: #b8b0a0;
  font-style: italic;
}

.order-field {
  padding: 14px 20px;
  border-bottom: 1px solid #ece3d6;
}
.order-field label {
  display: block;
  font-size: 1rem;
  color: #6b6b6b;
  margin-bottom: 6px;
}
.order-field label .required { color: #4F4FEA; }
.order-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #d8d0c2;
  border-radius: 4px;
  padding: 9px 12px;
  background: #fff;
  min-height: 18px;
  font-size: 1rem;
}

.order-row-2 {
  display: flex;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #ece3d6;
}
.order-row-2 > div { flex: 1; min-width: 0; }

.order-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 20px;
  border-bottom: 1px solid #ece3d6;
  font-size: 1rem;
}
.order-note svg { flex-shrink: 0; margin-top: 2px; color: #4F4FEA; }
.order-note .note-label { color: #8a8a8a; font-size: 1rem; }
.order-note .note-text { color: #333; margin-top: 2px; }

.order-table-wrap { overflow-x: auto; }
table.order-products {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  table-layout: fixed;
}
table.order-products th {
  text-align: left;
  color: #6b6b6b;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 10px 12px;
  border-bottom: 1px solid #ece3d6;
  white-space: nowrap;
}
table.order-products td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1ebe0;
  vertical-align: top;
}
table.order-products th.num, table.order-products td.num { text-align: right; }
table.order-products th.idx, table.order-products td.idx { width: 5%; color: #b0a99b; }
table.order-products th.row-actions, table.order-products td.row-actions { width: 8%; text-align: center; color: #4F4FEA; white-space: nowrap; }
table.order-products th.col-code, table.order-products td.col-code { width: 48%; }
table.order-products th.col-unit, table.order-products td.col-unit { width: 10%; }
table.order-products th.col-qty, table.order-products td.col-qty { width: 15%; }
table.order-products th.col-last-ordered, table.order-products td.col-last-ordered { width: 15%; white-space: normal; }
.prod-sku {
  font-size: 1rem;
  color: #8a8a8a;
  letter-spacing: .02em;
}
.prod-name {
  font-weight: 600;
  font-size: 1rem;
  margin-top: 2px;
}
.item-desc-line {
  margin-top: 2px;
  font-size: 1rem;
  line-height: 1.3;
  color: #333;
  font-weight: 600;
}
.code-unknown {
  font-weight: 400;
  font-size: 1rem;
  color: #a3372c;
}
.code-substituted {
  font-weight: 400;
  font-size: 1rem;
  color: #8a6d1f;
  margin-top: 2px;
}
.item-original-phrase {
  font-size: 0.9rem;
  font-style: italic;
  color: #8a8371;
  margin-top: 1em;
}

.order-products input[type="text"],
.order-products input[type="number"],
.order-products select {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 4px 6px;
  border-radius: 4px;
}
.order-products input[type="number"] { text-align: right; }
.order-products input[type="text"]:hover,
.order-products input[type="text"]:focus,
.order-products input[type="number"]:hover,
.order-products input[type="number"]:focus,
.order-products select:hover,
.order-products select:focus {
  border-color: #d8d0c2;
  background: #fff;
  outline: none;
}
.trash-btn, .edit-btn {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 4px;
}
.trash-btn:hover, .edit-btn:hover { background: #f1ebe0; }
.edit-btn.active { background: #ece6f9; color: #4F4FEA; }

.col-code .placeholder-text,
.col-unit .placeholder-text,
.col-qty .placeholder-text {
  font-style: italic;
}

.order-add {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  color: #4F4FEA;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .02em;
  text-align: left;
  cursor: pointer;
}
.order-add:hover { background: #f6efe4; }

/* ---- Comments thread (beneath the order preview) ---- */
.comments-card {
  margin-top: 16px;
  font-size: 1rem;
}
.comments-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.comment-item {
  padding: 10px 0;
  border-top: 1px solid #ece3d6;
}
.comments-empty {
  padding: 0 0 16px;
}
.comment-meta {
  font-size: 1rem;
  color: #6b6b6b;
  margin-bottom: 2px;
}
.comment-meta strong { color: #1f1f1f; }
.comment-date { margin-left: 6px; color: #8a8a8a; }
.comment-order-link { float: right; color: #4F4FEA; text-decoration: none; font-weight: 600; }
.comment-order-link:hover { text-decoration: underline; }
.comment-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-text a { color: #4F4FEA; }
.comment-text a.comment-hashtag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #ECECFD;
  color: #4F4FEA;
  text-decoration: none;
  font-weight: 600;
}
.comment-text a.comment-hashtag:hover { background: #DCDCFB; }
.hashtag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.hashtag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: #ECECFD;
  color: #4F4FEA;
  text-decoration: none;
  font-weight: 600;
}
.hashtag-badge:hover { background: #DCDCFB; }
.hashtag-badge.active { background: #4F4FEA; color: #fff; }
.hashtag-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #4F4FEA;
  font-size: 0.85em;
  text-align: center;
}
.comment-delete-btn {
  float: right;
  border: none;
  background: none;
  color: #b0b0b0;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.comment-delete-btn:hover { color: #c0392b; }
.comment-item-deleted .comment-meta { color: #a8a8a8; }
.comment-item-deleted .comment-meta strong { color: #a8a8a8; }
.comment-text-deleted {
  color: #a8a8a8;
  font-style: italic;
}
.item-code-link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed #4F4FEA;
}
.item-code-link:hover { text-decoration: none; }

.item-code-tooltip {
  position: absolute;
  z-index: 1000;
  min-width: 220px;
  max-width: 360px;
  background: #fff;
  border: 1px solid #d8d0c2;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  font-size: 0.9rem;
}
.item-tooltip-row {
  display: flex;
  gap: 10px;
  padding: 3px 12px;
}
.item-tooltip-row:hover { background: #faf6ee; }
.item-tooltip-label {
  color: #8a8a8a;
  flex: 0 0 auto;
  white-space: nowrap;
}
.item-tooltip-value {
  color: #1f1f1f;
  font-weight: 600;
  text-align: right;
  margin-left: auto;
  word-break: break-word;
}
/* Marks the computed rows (parsed weight, times sold) appended below the raw inventory.csv
   columns - see itemTooltipHtml in htmlUtils.js / buildItemTooltipHtml in admin-order.js -
   so it's visually obvious which values were derived rather than read straight off the CSV. */
.item-tooltip-divider {
  margin-top: 4px;
  padding: 5px 12px 3px;
  border-top: 1px dashed #d8d0c2;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #4F4FEA;
}
.item-tooltip-row-enriched { background: #f5f3ff; }
.item-tooltip-row-enriched:hover { background: #ece6f9; }
.item-tooltip-row-enriched .item-tooltip-label { color: #4F4FEA; }
/* Plain-text body for the shared instant tooltip (see comment-tooltip.js) - used by the
   Phase 6 match-formula coefficients, as opposed to the transposed inventory-row layout
   above (.item-tooltip-row) used for item codes. */
.item-tooltip-text {
  padding: 6px 12px;
  color: #333;
  white-space: pre-line;
}
.comment-form {
  padding: 14px 0 0;
  border-top: 1px solid #ece3d6;
}
.comment-form textarea {
  width: 100%;
  border: 1px solid #d8d0c2;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 1rem;
  min-height: 60px;
  font-family: inherit;
  resize: vertical;
}
.comment-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.comment-form button {
  background: #4F4FEA;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.comment-form button:hover { background: #3f3fd0; }
.comment-form button:disabled { background: #b8b0a0; cursor: default; }
.comment-status { font-size: 1rem; color: #6b6b6b; }
.comment-status.error { color: #a3372c; }

.save-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid #ece3d6;
}
.save-bar button {
  background: #4F4FEA;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.save-bar button:hover { background: #3f3fd0; }
.save-bar button:disabled { background: #b8b0a0; cursor: default; }
.save-status { font-size: 1rem; color: #6b6b6b; }
.save-status.success { color: #1f7a3f; }
.save-status.error { color: #a3372c; }

/* ---- Expensive double-check (per-line + general comments) ---- */
table.order-products.check-table th.col-code, table.order-products.check-table td.col-code { width: 20%; }
table.order-products.check-table th.col-unit, table.order-products.check-table td.col-unit { width: 8%; }
table.order-products.check-table th.col-qty, table.order-products.check-table td.col-qty { width: 15%; }
table.order-products.check-table th.col-comment, table.order-products.check-table td.col-comment { width: 52%; white-space: normal; }
tr.row-flagged td { background: #faf5ff; }
.line-comment {
  display: block;
  background: #f3e8ff;
  color: #6b21a8;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 1rem;
  line-height: 1.35;
}
.general-comment {
  margin-top: 16px;
  padding: 14px 16px;
  background: #f3e8ff;
  border: 1px solid #d8b4fe;
  border-radius: 10px;
  color: #581c87;
  font-size: 1rem;
  line-height: 1.4;
}
.general-comment strong {
  display: block;
  color: #6b21a8;
  margin-bottom: 4px;
}

/* ---- Old/new diff highlighting ---- */
.diff-changed {
  background: #fff6df !important;
  border-color: #e3c869 !important;
}
.diff-added {
  background: #e6f7ec !important;
  border-color: #93d3ac !important;
}
.diff-old-value {
  display: block;
  font-size: 1rem;
  color: #000;
  opacity: 0.5;
  filter: grayscale(1);
  text-decoration: line-through;
  margin-top: 2px;
}
/* .item-code-link sets its own text-decoration: none, which (since the property isn't
   inherited) overrides the line-through above - reapply it so a linkified old code still
   reads as struck through. grayscale(1)/opacity above are inherited fine since they're
   applied via filter/opacity on the parent box, not per-descendant color. */
.diff-old-value .item-code-link { text-decoration: line-through; }
tr.removed-row td { color: #000; opacity: 0.5; filter: grayscale(1); }
.removed-text { text-decoration: line-through; }
/* text-decoration-line isn't inherited, and .item-code-link/.item-desc-line each set
   their own (none / no decoration) - so the strikethrough has to be re-applied on every
   nested piece explicitly rather than relying on it propagating down from .removed-text. */
.removed-text .item-code-link,
.removed-text .code-unknown,
.removed-text .item-desc-line,
.removed-text .item-original-phrase {
  text-decoration: line-through;
}

/* ---- Pipeline / debug view ---- */
.pipeline-phase {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #fafafa;
}
.pipeline-phase h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.pipeline-phase table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.pipeline-phase th, .pipeline-phase td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.pipeline-phase details {
  margin-top: 4px;
  font-size: 1rem;
}
.pipeline-phase summary {
  cursor: pointer;
  color: #4F4FEA;
  font-weight: 600;
}
.pipeline-phase pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 8px;
  margin: 4px 0 0;
  max-height: 260px;
  overflow: auto;
}
/* /admin/search only (see searchPage.js) - the LLM response is the thing being
   inspected there, not an incidental debug detail, so let it grow with the page instead
   of scrolling in its own little box. */
.search-phase-response pre {
  max-height: none;
  overflow: visible;
}
.search-page {
  max-width: 768px;
}
.pipeline-phase .match-line {
  font-size: 1rem;
  margin-top: 6px;
}
.link-button {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: #4F4FEA;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }
/* Code/Score/Formula are real columns of the Phase 6 table (see matchRowHtml in
   pipelinePhases.js) rather than a stacked div layout, so every match's closeness bar
   lines up on the same vertical line - both across a query's own candidates and across
   different query rows. table-layout:fixed + explicit column widths (rather than leaving
   it to content-based auto sizing) is what keeps the Code column from ballooning out to
   however much space is left over - a short "SQU200F" got just as wide a column as a long
   product description otherwise. */
.pipeline-phase .inventory-match-table { table-layout: fixed; }
.pipeline-phase .inventory-match-table th:nth-child(1), .pipeline-phase .inventory-match-table td:nth-child(1) { width: 24%; }
.pipeline-phase .inventory-match-table th:nth-child(2), .pipeline-phase .inventory-match-table td:nth-child(2) { width: 20%; }
.pipeline-phase .inventory-match-table th:nth-child(3), .pipeline-phase .inventory-match-table td:nth-child(3) { width: 28%; }
.pipeline-phase .inventory-match-table th:nth-child(4), .pipeline-phase .inventory-match-table td:nth-child(4) { width: 28%; }
.pipeline-phase .inventory-match-table .match-code-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-phase .match-bar-track {
  width: 100%;
  max-width: 200px;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}
.pipeline-phase .match-bar-fill { height: 100%; border-radius: 3px; }
.pipeline-phase .match-bar-fill.match-bar-high { background: #1f7a3f; }
.pipeline-phase .match-bar-fill.match-bar-mid { background: #b8941f; }
.pipeline-phase .match-bar-fill.match-bar-low { background: #a3372c; }
.pipeline-phase .match-formula-cell {
  font-size: 0.85rem;
  color: #6b6b6b;
}
.pipeline-phase .match-coef,
.pipeline-phase .match-final-score {
  cursor: help;
  border-bottom: 1px dotted #999;
}
.pipeline-phase .match-final-score { color: #1f1f1f; }
.pipeline-phase .token-usage {
  font-size: 1rem;
  color: #8a8a8a;
  margin-bottom: 4px;
}
.pipeline-phase .phase-status {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.pipeline-phase .phase-status.status-error { color: #c0392b; }
.pipeline-phase .phase-status.status-done { color: #2a8a4a; }

/* ---- Submit order form ---- */
.submit-form { max-width: 680px; }
.submit-form textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid #d8d0c2; border-radius: 6px; }
.submit-form .actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.submit-form button { background: #4F4FEA; color: #fff; border: none; border-radius: 6px; padding: 9px 18px; font-weight: 600; font-size: 1rem; cursor: pointer; }
.submit-form button:hover { background: #3f3fd0; }

/* ---- Admin orders list ---- */
table.orders-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  margin-top: 12px;
}
table.orders-list th {
  text-align: left;
  color: #6b6b6b;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 10px 12px;
  border-bottom: 2px solid #ece3d6;
}
table.orders-list td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1ebe0;
}
table.orders-list tr:hover td { background: #fafafa; }
/* Monospace so the hex segments line up column-wise and are easy to compare by eye. */
.order-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #4F4FEA;
  text-decoration: none;
}
.order-id:hover { text-decoration: underline; }
.external-link-icon {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
  color: #9c9488;
}
.external-link-icon:hover { color: #4F4FEA; }
.pagination-bar {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  font-size: 1rem;
}
.pagination-bar a, .pagination-bar span.disabled {
  padding: 6px 14px;
  border: 1px solid #d8d0c2;
  border-radius: 6px;
  text-decoration: none;
}
.pagination-bar span.disabled { color: #b8b0a0; }
.pagination-page { color: #6b6b6b; align-self: center; }

/* ---- Comment-author avatar bubbles (Comments column on /admin/orders) ---- */
.avatar-stack {
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}
.avatar-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  margin-left: -8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.6875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar-bubble:first-child { margin-left: 0; }
.avatar-bubble-lg { width: 32px; height: 32px; margin-left: 0; font-size: 0.8125rem; border: none; }

/* ---- Avatar color picker (/account) ---- */
.avatar-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.avatar-color-option { cursor: pointer; }
.avatar-color-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.avatar-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-color-option input:checked + .avatar-color-swatch {
  border-color: #1f1f1f;
  box-shadow: 0 0 0 2px #fff inset;
}

/* ---- Read-only CSV data tables (customers/inventory/sales) ---- */
.btn-disabled {
  background: #b8b0a0;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 1rem;
  cursor: not-allowed;
}
.hint-text {
  color: #8a8a8a;
  font-size: 1rem;
  font-style: italic;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.table-filter {
  width: 440px;
  max-width: 100%;
  border: 1px solid #d8d0c2;
  border-radius: 6px;
  padding: 9px 12px;
  font: inherit;
  font-size: 1rem;
}
.table-filter:focus {
  outline: none;
  border-color: #4F4FEA;
}
.filter-highlight {
  background: #fff3c9;
  padding: 0 .5ex;
}
.data-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
table.data-table th {
  text-align: left;
  color: #6b6b6b;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 10px 12px;
  border-bottom: 2px solid #ece3d6;
  white-space: nowrap;
}
table.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1ebe0;
  white-space: nowrap;
}
table.data-table tr:hover td { background: #fafafa; }

.table-footer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.table-footer-bar #rowCountNote { margin: 0; }
.btn-secondary {
  background: #fff;
  color: #4F4FEA;
  border: 1px solid #4F4FEA;
  border-radius: 6px;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.btn-secondary:hover { background: #f6efe4; }
.btn-secondary:disabled { color: #b8b0a0; border-color: #d8d0c2; cursor: default; }
a.btn-secondary { display: inline-block; text-decoration: none; }
.btn-danger { background: #fdeaea; color: #a3372c; border-color: #f0c4c0; }
.btn-danger:hover { background: #f9d8d5; }

/* ---- Submitted text (read-only, with line-item phrase highlighting) ---- */
.submitted-text {
  width: 100%;
  height: 330px;
  overflow: auto;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #333;
  background: #fff;
  border: 1px solid #d8d0c2;
  border-radius: 4px;
  padding: 8px 10px;
}
.text-phrase {
  text-decoration: underline;
  text-decoration-color: #c9bfa8;
  text-underline-offset: 2px;
  border-radius: 2px;
  cursor: pointer;
}
.text-phrase:hover,
.text-phrase.highlight {
  background: #fff3c9;
  text-decoration-color: #8a6d1f;
}
tr.line-highlight td { box-shadow: inset 0 0 0 9999px rgba(79, 79, 234, 0.08); }

/* ---- Source tabs (email body / each attachment / linked order) ---- */
.source-tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: -1px;
}
.source-tab {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: inherit;
  font-size: 13px;
  color: #6b6358;
  background: #f4efe6;
  border: 1px solid #d8d0c2;
  border-radius: 4px 4px 0 0;
  padding: 5px 10px;
  cursor: pointer;
}
.source-tab:hover { color: #333; }
.source-tab.active {
  color: #333;
  font-weight: 600;
  background: #fff;
  border-bottom-color: #fff;
  z-index: 1;
}
.source-tab-count {
  display: inline-block;
  min-width: 16px;
  margin-left: 4px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  color: #8a6d1f;
  background: #fff3c9;
  border-radius: 8px;
}
.source-tab-error {
  margin-left: 4px;
  font-weight: 700;
  color: #a3372c;
}
.source-pane[hidden] { display: none; }
.source-pane .submitted-text { border-top-left-radius: 0; }
.source-note {
  margin: 6px 0 0;
  padding: 6px 10px;
  font-size: 12px;
  color: #6b6358;
  background: #faf6ee;
  border: 1px solid #e8e0d0;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.source-note-error { color: #a3372c; background: #fdeaea; border-color: #f0c4c0; }
.attachment-phase + .attachment-phase { margin-top: 10px; }
.attachment-phase .source-note { margin-top: 4px; }

/* ---- Synonyms column (/admin/inventory) ---- */
table.data-table td.synonyms-cell {
  white-space: normal;
  min-width: 220px;
  max-width: 360px;
  vertical-align: top;
}
.synonym-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}
.synonym-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f5f3ff;
  border: 1px solid #e0dafa;
  border-radius: 12px;
  padding: 2px 4px 2px 8px;
  font-size: 0.875rem;
  white-space: nowrap;
}
.synonym-chip a { color: #4F4FEA; text-decoration: none; }
.synonym-chip a:hover { text-decoration: underline; }
.synonym-remove-btn {
  border: none;
  background: none;
  color: #a49bd6;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.synonym-remove-btn:hover { color: #c0392b; }
.synonym-add-form { margin: 0; }
.synonym-add-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e3dccb;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.875rem;
}

