/* ── Preview panel ──────────────────────────────────────────────────────────── */
.preview-empty {
  background: var(--surface);
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.preview-empty-icon { font-size: 26px; color: var(--muted2); margin-bottom: 12px; }
.preview-empty-title { font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.preview-empty-sub { font-size: 12px; color: var(--muted2); line-height: 1.6; }

.preview-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--black);
  position: sticky;
  top: 0;
  z-index: 2;
}
.preview-header-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preview-proj { font-family: var(--font); font-size: 13px; font-weight: 700; color: #ffffff; margin-bottom: 1px; }
.preview-client { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.75); }
.preview-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 1px; }
.preview-meta { font-size: 11px; color: rgba(255,255,255,0.45); }
.preview-status-badge {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  flex-shrink: 0;
}
.preview-status-badge[data-status="Sam to proceed"] { background: rgba(34,197,94,0.2); color: #86efac; }
.preview-status-badge[data-status="To be checked by Manoj"] { background: rgba(251,191,36,0.2); color: #fde68a; }
.preview-status-badge[data-status="WIP"] { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.55); }
.preview-timestamps { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 3px; }
.preview-total-box { text-align: right; flex-shrink: 0; }
.preview-total-label { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.preview-total { font-family: var(--font); font-size: 18px; font-weight: 800; color: #ffffff; }

.preview-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th {
  text-align: left;
  font-family: var(--font);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--surface);
}
.preview-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
.preview-table td.cost-td { text-align: right; font-weight: 600; color: var(--dark); white-space: nowrap; }
.preview-table .scope-td { color: var(--muted); font-size: 11px; font-style: italic; }
.cost-th { text-align: right !important; }
.scope-list { list-style: none; padding: 0; margin: 0; }
.scope-list li { position: relative; padding-left: 12px; line-height: 1.65; margin-bottom: 2px; }
.scope-list li::before { content: '•'; position: absolute; left: 0; color: var(--muted2); font-size: 10px; top: 1px; }
.del-item-th { width: 60px; }
.del-item-td { width: 60px; padding: 4px 4px !important; text-align: center; vertical-align: middle !important; white-space: nowrap; }

/* ── Drag-to-reorder handle ──────────────────────────────────────────────────── */
.drag-th { width: 24px; }
.drag-td { width: 24px; padding: 4px 0 4px 6px !important; text-align: center; vertical-align: middle !important; }
.drag-handle {
  cursor: grab;
  color: var(--muted2);
  font-size: 14px;
  line-height: 1;
  user-select: none;
  display: inline-block;
  padding: 2px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.drag-handle:hover { color: #FFA320; background: rgba(255,163,32,0.1); }
.drag-handle:active { cursor: grabbing; }
.preview-table tr.dragging { opacity: 0.4; }
.preview-table tr.drag-over td { box-shadow: inset 0 2px 0 #FFA320; }
.del-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted2);
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.del-item-btn:hover { color: var(--danger); background: rgba(184,50,50,0.08); }
.edit-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted2);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.edit-item-btn:hover { color: #2563eb; background: rgba(37,99,235,0.08); }

.preview-totals {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.tot-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding: 3px 0;
  font-family: var(--font);
}
.tot-row.grand {
  color: var(--black);
  font-weight: 800;
  font-size: 14px;
  border-top: 1px solid var(--border2);
  margin-top: 7px;
  padding-top: 8px;
}

.preview-actions {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.preview-actions .secondary-btn {
  margin-left: auto;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Preview table item layout (stacked name + detail) ───────────────────────── */
.prev-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  line-height: 1.4;
}
.prev-item-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── Sanity check issues panel ───────────────────────────────────────────────── */
.sanity-issues {
  margin: 0 20px 0;
  padding: 12px 16px;
  background: rgba(255,163,32,0.08);
  border: 1px solid rgba(255,163,32,0.3);
  border-radius: 8px;
}
.sanity-title {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  color: #e8920a;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.sanity-issue-item {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,163,32,0.15);
  line-height: 1.5;
}
.sanity-issue-item:last-child { border-bottom: none; }
.sanity-issue-item strong { color: var(--dark); }
