/* Base layout */
.vd-vof {
  --vd-gap: 12px;
  --vd-radius: 12px;
  --vd-border: #e5e7eb;
  --vd-muted: #6b7280;
  --vd-bg: #ffffff;
  --vd-bg-soft: #f9fafb;
  --vd-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  font-size: 14px;
  line-height: 1.5;
  color: #111827;
}

.vd-vof * {
  box-sizing: border-box;
}

/* Toolbar */
.vd-vof__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--vd-gap);
  margin-bottom: var(--vd-gap);
  flex-wrap: wrap;
}

.vd-vof__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.vd-vof__filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--vd-muted);
}

.vd-vof__filter select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--vd-border);
  background-color: #ffffff;
}

/* Table */
.vd-vof__table {
  width: 100%;
  border-collapse: collapse;
  background: var(--vd-bg);
  border-radius: var(--vd-radius);
  box-shadow: var(--vd-shadow);
  overflow: hidden;
}

.vd-vof__table thead {
  background: #f3f4f6;
}

.vd-vof__table th,
.vd-vof__table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.vd-vof__table th {
  font-weight: 600;
  color: #4b5563;
}

.vd-vof__table tbody tr:last-child td {
  border-bottom: none;
}

/* Pills & badges */
.vd-vof__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #eef2ff;
  color: #3730a3;
  margin-right: 6px;
}

.vd-vof__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #e5e7eb;
  color: #374151;
}

/* Different status colors (tweak as needed) */
.vd-vof__badge--status-completed {
  background: #dcfce7;
  color: #166534;
}

.vd-vof__badge--status-processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.vd-vof__badge--status-on-hold {
  background: #fef3c7;
  color: #92400e;
}

.vd-vof__badge--status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

/* Columns */
.vd-vof__col--id a {
  color: #111827;
  text-decoration: none;
}

.vd-vof__col--id a:hover {
  text-decoration: underline;
}

/* Actions: icon buttons */
.vd-vof__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vd-vof__icon-btn {
  appearance: none;
  border: 1px solid var(--vd-border);
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease, transform 0.08s ease,
    box-shadow 0.12s ease, border-color 0.12s ease;
}

.vd-vof__icon-btn:hover {
  background: var(--vd-bg-soft);
  border-color: #d1d5db;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.vd-vof__icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.vd-vof__icon {
  font-size: 12px;
  line-height: 1;
  font-weight: 500;
}

/* Specific icon accents */
.vd-vof__icon-btn--status-completed .vd-vof__icon {
  color: #16a34a;
}

.vd-vof__icon-btn--status-onhold .vd-vof__icon {
  color: #f97316;
}

.vd-vof__icon-btn--status-cancelled .vd-vof__icon {
  color: #dc2626;
}

/* Fallback status form button (hidden in normal use) */
.vd-vof__status-submit {
  display: none;
}

/* Status buttons in modal footer */
.vd-vof__inline-form--status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.vd-vof__status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vd-vof__status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  transition: background-color 0.12s ease, border-color 0.12s ease,
    box-shadow 0.12s ease, transform 0.06s ease;
}

.vd-vof__status-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.vd-vof__status-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.vd-vof__status-btn--current {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.vd-vof__status-emoji {
  font-size: 14px;
}

.vd-vof__status-label {
  white-space: nowrap;
}

/* Quote footer actions */
.vd-vof__quote-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.vd-vof__quote-actions-label {
  font-size: 12px;
  color: var(--vd-muted);
}

.vd-vof__quote-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.vd-vof__quote-emoji {
  font-size: 14px;
}

/* Inline note form (in modal) */
.vd-vof__inline-form--note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
}

.vd-vof__note-label {
  flex: 1 1 auto;
}

.vd-vof__note-input {
  width: 100%;
  min-height: 60px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--vd-border);
  resize: vertical;
}

.vd-vof__note-submit {
  white-space: nowrap;
}

/* Simple button baseline (for note submit, etc.) */
.vd-vof button.button,
.vd-vof .button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  cursor: pointer;
  font-size: 13px;
}

.vd-vof button.button:hover,
.vd-vof .button:hover {
  background: #f3f4f6;
}

/* Pagination */
.vd-vof__pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 13px;
}

.vd-vof__page {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  text-decoration: none;
}

.vd-vof__page--current {
  font-weight: 500;
}

/* Error */
.vd-vof--error {
  color: #b91c1c;
}

/* Modal */
.vd-vof-modal-open {
  overflow: hidden;
}

.vd-vof-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: block;
}

.vd-vof-modal[hidden] {
  display: none;
}

.vd-vof-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.vd-vof-modal__dialog {
  position: relative;
  max-width: 960px;
  margin: 6vh auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vd-vof-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #4b5563;
}

.vd-vof-modal__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--vd-border);
}

.vd-vof-modal__header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.vd-vof-modal__body {
  padding: 16px 20px 10px;
  max-height: 65vh;
  overflow: auto;
}

.vd-vof-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--vd-border);
  background: #f9fafb;
}

/* Summary in modal */
.vd-vof__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}

.vd-vof__summary-main {
  flex: 2 1 220px;
}

.vd-vof__summary-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}

.vd-vof__summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--vd-muted);
}

.vd-vof__summary-list {
  flex: 1 1 190px;
  margin: 0;
}

.vd-vof__summary-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}

.vd-vof__summary-row dt {
  font-weight: 500;
  color: #4b5563;
}

.vd-vof__summary-row dd {
  margin: 0;
  color: #111827;
}

.vd-vof__summary-list--contact a {
  color: #2563eb;
  text-decoration: none;
}

.vd-vof__summary-list--contact a:hover {
  text-decoration: underline;
}

/* Sections */
.vd-vof__section {
  margin-bottom: 16px;
}

.vd-vof__section-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

/* Lines (items) */
.vd-vof__lines {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f9fafb;
}

.vd-vof__line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed #e5e7eb;
  gap: 8px;
}

.vd-vof__line:last-child {
  border-bottom: none;
}

.vd-vof__line-main {
  flex: 2 1 240px;
}

.vd-vof__line-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
}

.vd-vof__line-attrs {
  font-size: 12px;
  color: var(--vd-muted);
}

.vd-vof__item-meta {
  margin: 0;
  padding-left: 16px;
}

.vd-vof__item-meta li {
  list-style: disc;
}

.vd-vof__line-meta {
  flex: 1 1 140px;
  text-align: right;
  font-size: 12px;
  color: #374151;
}

.vd-vof__line-meta span {
  display: block;
}

/* Totals */
.vd-vof__totals-list {
  margin: 0;
}

.vd-vof__totals-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}

.vd-vof__totals-row dt {
  font-weight: 500;
  color: #4b5563;
}

.vd-vof__totals-row dd {
  margin: 0;
  font-weight: 500;
}

.vd-vof__totals-row--grand dt {
  font-weight: 600;
}

.vd-vof__totals-row--grand dd {
  font-weight: 700;
}

/* Addresses */
.vd-vof__addresses {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.vd-vof__address-block {
  flex: 1 1 220px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  background: #f9fafb;
}

.vd-vof__address-block h6 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}

.vd-vof__address-body {
  font-size: 13px;
}

/* Meta list */
.vd-vof__meta-list {
  margin: 0;
}

.vd-vof__meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed #e5e7eb;
}

.vd-vof__meta-row:last-child {
  border-bottom: none;
}

.vd-vof__meta-row dt {
  font-weight: 500;
  color: #4b5563;
}

.vd-vof__meta-row dd {
  margin: 0;
  color: #111827;
}

/* Attachment thumbnails in meta */
.vd-vof__meta-row--attachment dd {
  display: flex;
  justify-content: flex-end;
}

.vd-vof__attachment-link {
  display: inline-block;
}

.vd-vof__attachment-thumb {
  max-width: 80px;
  max-height: 80px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  object-fit: cover;
  background: #f9fafb;
}

/* Notes */
.vd-vof__notes-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.vd-vof__note {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: #f9fafb;
}

.vd-vof__note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--vd-muted);
  margin-bottom: 3px;
}

.vd-vof__note-content {
  font-size: 12px;
}

/* Hidden cells */
.vd-vof__hidden-cell {
  padding: 0 !important;
  border: 0 !important;
}

/* Small helper */
.vd-vof__empty {
  font-size: 13px;
  color: var(--vd-muted);
}

.mfp-wrap {
  z-index: 999999 !important;
}


/* Responsive (stack rows to cards on small screens) */
@media (max-width: 768px) {
  .vd-vof__table,
  .vd-vof__table thead,
  .vd-vof__table tbody,
  .vd-vof__table th,
  .vd-vof__table td,
  .vd-vof__table tr {
    display: block;
  }

  .vd-vof__table thead {
    display: none;
  }

  .vd-vof__table tbody tr {
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  }

  .vd-vof__table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 12px;
  }

  .vd-vof__table td:last-child {
    border-bottom: none;
  }

  .vd-vof__table td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--vd-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .vd-vof__col--id::before {
    content: 'Type';
  }

  .vd-vof__actions {
    justify-content: flex-start;
  }

  .vd-vof-modal__dialog {
    margin: 4vh 12px;
    max-width: none;
  }

  .vd-vof__inline-form--status,
  .vd-vof__quote-actions {
    margin-bottom: 8px;
  }
}


/* === Integrated Vendor Comms Chat inside modal === */
.vd-vof__section--chat { margin-top: 18px; }
.vd-vof__section--chat .kkvc-chat { border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; overflow: hidden; max-height: 420px; }
.vd-vof__section--chat .kkvc-chat__sidebar { display: none; } /* Hide thread list inside order context */
.vd-vof__section--chat .kkvc-chat__main { width: 100%; }
.vd-vof__section--chat .kkvc-chat__messages { max-height: 260px; overflow: auto; }
