/* ─────────────────────────────────────────────────────────────────────────
   Smart Intake (V2) — bulk upload workspace + Files/Opinions V2 list.
   Kept as one global stylesheet (not per-component scoped CSS) because
   SmartIntake.razor's child components render their own markup, which
   Blazor's CSS isolation would not reach from a parent .razor.css file.
   All rules are prefixed .si- / .fo2- to avoid colliding with Bootstrap
   or the rest of the app.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --si-border: #d9dee3;
  --si-border-strong: #b9c2cb;
  --si-surface-2: #f6f8fa;
  --si-text-muted: #8a94a0;
  --si-success-bg: #e6f6ec; --si-success-text: #1a7a43; --si-success-border: #a9dcc0;
  --si-warning-bg: #fff6e0; --si-warning-text: #8a6100; --si-warning-border: #f0d896;
  --si-danger-bg: #fdeaea; --si-danger-text: #b3261e; --si-danger-border: #f0b4b0;
  --si-accent: #0d6efd;
}

/* ── Files / Opinions V2 list page ── */
.fo2-page { max-width: 1200px; }
.fo2-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; gap: 1rem; }
.fo2-badge { font-size: 0.65rem; vertical-align: middle; background: var(--si-accent); color: #fff; padding: 2px 8px; border-radius: 20px; margin-left: 6px; }
.fo2-subtitle { color: var(--si-text-muted); font-size: 0.88rem; max-width: 640px; margin: 0; }
.fo2-toolbar { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.fo2-empty { text-align: center; padding: 3rem 1rem; color: var(--si-text-muted); }
.fo2-empty i { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

.fo2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.fo2-card {
  border: 1px solid var(--si-border); border-radius: 10px; background: #fff;
  padding: 1rem; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
}
.fo2-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); border-color: var(--si-accent); }
.fo2-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.fo2-card-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--si-surface-2); display: flex; align-items: center; justify-content: center; color: var(--si-accent); }
.fo2-card-title { font-weight: 700; font-size: 1rem; }
.fo2-card-sub { color: #495057; font-size: 0.88rem; }
.fo2-card-bank { font-size: 0.8rem; color: var(--si-text-muted); margin-top: 2px; }
.fo2-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px solid var(--si-border); font-size: 0.78rem; color: var(--si-text-muted); }
.fo2-open-link { color: var(--si-accent); font-weight: 600; }

/* Click-to-change status badge (grid cards + Smart Intake header) */
.fo2-status-badge { cursor: pointer; }
.fo2-status-badge:hover { opacity: 0.85; }
.fo2-status-select { width: auto; display: inline-block; padding-top: 2px; padding-bottom: 2px; font-size: 0.8rem; }

/* Board (Kanban) view */
.fo2-board { display: flex; gap: 0.7rem; overflow-x: auto; padding-bottom: 0.5rem; }
.fo2-board-col {
  flex: 0 0 220px; background: var(--si-surface-2); border: 1px solid var(--si-border);
  border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 260px);
  transition: border-color 0.15s, box-shadow 0.15s, flex-basis 0.15s;
}
/* An empty status column has nothing to show but still needs to stay a valid drop target —
   shrink it to a slim strip instead of giving it the same width as a populated column, so a
   board with several empty statuses (the common case) doesn't burn horizontal space on them. */
.fo2-board-col-collapsed { flex: 0 0 130px; max-height: none; }
.fo2-board-col-dragover { border-color: var(--si-accent); box-shadow: 0 0 0 2px rgba(13,110,253,0.15); }
.fo2-board-col-header {
  display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--si-border); font-weight: 600;
}
.fo2-board-col-count { color: var(--si-text-muted); font-size: 0.8rem; }
.fo2-board-col-body { padding: 0.6rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.fo2-board-card {
  background: #fff; border: 1px solid var(--si-border); border-radius: 8px; padding: 0.65rem 0.75rem;
  cursor: grab; transition: box-shadow 0.15s, border-color 0.15s;
}
.fo2-board-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); border-color: var(--si-accent); }
.fo2-board-card:active { cursor: grabbing; }
.fo2-board-empty {
  text-align: center; color: var(--si-text-muted); font-size: 0.78rem; margin: 0.6rem;
  padding: 0.5rem; border: 1px dashed var(--si-border); border-radius: 8px;
}

/* ── Smart Intake workspace ── */
.si-page { max-width: 1400px; }

.si-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }

.si-main-tabstrip { display: flex; gap: 4px; border-bottom: 1px solid var(--si-border); margin-bottom: 1rem; }
.si-main-tab {
  border: none; background: none; padding: 8px 14px; font-size: 0.86rem; font-weight: 500;
  color: var(--si-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.si-main-tab:hover { color: #2b2f33; }
.si-main-tab.active { color: var(--si-accent); border-bottom-color: var(--si-accent); }
.si-back { font-size: 0.82rem; color: var(--si-text-muted); text-decoration: none; display: block; margin-bottom: 4px; }
.si-back:hover { color: var(--si-accent); }
.si-header-sep { color: var(--si-border-strong); }
.si-header-meta { display: flex; gap: 0.6rem; align-items: center; margin-top: 4px; font-size: 0.85rem; color: var(--si-text-muted); }

.si-dropzone {
  border: 2px dashed var(--si-border-strong); border-radius: 12px; background: var(--si-surface-2);
  padding: 1.25rem; display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.si-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.si-dropzone-inner { flex: 1; display: flex; align-items: center; gap: 0.85rem; cursor: pointer; margin: 0; min-width: 240px; }
.si-dropzone-inner i { font-size: 1.8rem; color: var(--si-accent); }
.si-dropzone-hint { font-size: 0.8rem; color: var(--si-text-muted); margin-top: 2px; }
.si-manual-btn { flex-shrink: 0; }

.si-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 991px) { .si-body { grid-template-columns: 1fr; } }

.si-queue-col { min-width: 0; }
.si-queue-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 0.92rem; margin-bottom: 0.5rem; }
.si-queue-empty { text-align: center; padding: 2.5rem 1rem; color: var(--si-text-muted); border: 1px dashed var(--si-border); border-radius: 10px; }
.si-queue-empty i { font-size: 1.6rem; display: block; margin-bottom: 0.4rem; }
.si-category-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--si-text-muted); margin: 0.9rem 0 0.4rem; display: flex; gap: 6px; }

/* ── Queue row ── */
.si-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  border: 1px solid var(--si-border); border-radius: 8px; background: #fff;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s;
}
.si-row:hover { border-color: var(--si-accent); }
.si-row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.si-row-icon { font-size: 1.1rem; color: var(--si-text-muted); flex-shrink: 0; }
.si-row-text { min-width: 0; }
/* Wraps rather than ellipsis-truncating, so the Doc No / Date at the end of the line is never the part that gets cut off. */
.si-row-title { font-size: 0.86rem; font-weight: 500; overflow-wrap: anywhere; }
.si-row-sub { font-size: 0.78rem; color: var(--si-text-muted); margin-left: 8px; font-weight: 400; }
.si-row-meta { font-size: 0.78rem; color: var(--si-text-muted); margin-left: 8px; font-weight: 400; }
.si-row-meta strong { color: #495057; font-weight: 600; }
.si-row-meta-sep { margin: 0 5px; }
.si-row-warning { font-size: 0.76rem; color: var(--si-warning-text); margin-top: 2px; }
.si-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.si-row-danger { border-color: var(--si-danger-border); background: var(--si-danger-bg); }
.si-row-confirmed { border-color: var(--si-success-border); }
.si-row-muted { opacity: 0.55; }
.si-row-drop-target { border-top: 2px solid var(--si-accent); }
/* Pure-CSS 2x3 dot grip — no icon font dependency, so it can never silently fail to render. */
.si-row-grip {
  display: inline-grid; grid-template-columns: repeat(2, 3px); grid-auto-rows: 3px; gap: 3px;
  width: 9px; height: 15px; flex-shrink: 0; cursor: grab; align-content: center;
}
.si-row-grip:active { cursor: grabbing; }
.si-row-grip span { width: 3px; height: 3px; border-radius: 50%; background: var(--si-text-muted); }
.si-row-grip:hover span { background: var(--si-accent); }

.si-spin { animation: si-spin 1s linear infinite; }
@keyframes si-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Chips ── */
.si-chip { font-size: 11px; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.si-chip-success { background: var(--si-success-bg); color: var(--si-success-text); }
.si-chip-warning { background: var(--si-warning-bg); color: var(--si-warning-text); }
.si-chip-danger { background: var(--si-danger-bg); color: var(--si-danger-text); }
.si-chip-muted { background: var(--si-surface-2); color: var(--si-text-muted); border: 1px solid var(--si-border); }

/* ── Edit panel ── */
.si-edit-panel { border: 2px solid var(--si-accent); border-radius: 10px; background: #fff; padding: 14px 16px; margin-bottom: 8px; }
.si-edit-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.si-edit-title-block { font-size: 0.92rem; }
.si-edit-header-right { display: flex; align-items: center; gap: 8px; }
.si-busy { display: flex; align-items: center; gap: 8px; color: var(--si-text-muted); font-size: 0.85rem; padding: 1rem 0; }
.si-switch-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.85rem; background: var(--si-surface-2); border: 1px solid var(--si-border); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.si-classification-note { font-size: 0.8rem; color: #495057; background: var(--si-surface-2); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }

.si-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 10px; }
.si-field label { display: block; font-size: 11px; color: var(--si-text-muted); margin-bottom: 3px; }
.si-field-warn label { color: var(--si-warning-text); }
.si-input-warn { border-color: var(--si-warning-border) !important; background: #fffdf6; }
/* Each field sits in a .si-cell; which column comes from wwwroot/documentFieldLayout.json. A full-width cell
   spans both columns; an empty cell holds the blank half of a row so the other field stays on its own side. */
.si-cell { min-width: 0; }
.si-cell-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .si-field-grid { grid-template-columns: 1fr; } .si-cell-empty { display: none; } }

.si-field-group { display: flex; gap: 10px; flex-wrap: wrap; }
.si-field-group-child { flex: 1; min-width: 120px; }
.si-field-group-child label { display: block; font-size: 11px; color: var(--si-text-muted); margin-bottom: 3px; }

.si-subsection { margin: 12px 0; padding-top: 10px; border-top: 1px dashed var(--si-border); }
.si-subsection-title { font-size: 0.78rem; font-weight: 600; color: var(--si-text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.si-schedule-row, .si-correction-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }

.si-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.btn-accent { background: var(--si-accent); border-color: var(--si-accent); color: #fff; }
.btn-accent:hover { background: #0b5ed7; border-color: #0b5ed7; color: #fff; }

/* ── Side column: timeline + validation ── */
.si-side-col { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
.si-side-card { border: 1px solid var(--si-border); border-radius: 10px; background: var(--si-surface-2); padding: 1rem; }
.si-panel-title { font-size: 0.86rem; font-weight: 600; margin-bottom: 0.7rem; }

.si-timeline { position: relative; padding-left: 20px; }
.si-timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--si-border); }
.si-tl-item { position: relative; margin-bottom: 14px; }
.si-tl-dot { position: absolute; left: -20px; top: 2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--si-surface-2); }
.si-tl-dot-success { background: #2ea862; }
.si-tl-dot-danger { background: #d1453b; }
.si-tl-dot-pending { background: #fff; border-color: var(--si-border-strong); }
.si-tl-date { font-size: 13px; font-weight: 600; margin: 0; }
.si-tl-date-danger { color: var(--si-danger-text); }
.si-tl-meta { font-size: 11.5px; color: #495057; margin: 2px 0 0; }
.si-tl-status { font-size: 11px; margin: 2px 0 0; }
.si-tl-status-success { color: var(--si-success-text); }
.si-tl-status-muted { color: var(--si-text-muted); }
.si-dashed-break { height: 1px; margin: 0 0 14px -20px; background: repeating-linear-gradient(to right, var(--si-warning-border) 0 4px, transparent 4px 8px); }

.si-finding-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.si-finding { font-size: 0.8rem; padding: 6px 9px; border-radius: 6px; display: flex; gap: 6px; align-items: flex-start; }
.si-finding-info { background: #fff; border: 1px solid var(--si-border); color: #495057; }
.si-finding-warning { background: var(--si-warning-bg); color: var(--si-warning-text); border: 1px solid var(--si-warning-border); }
.si-finding-danger { background: var(--si-danger-bg); color: var(--si-danger-text); border: 1px solid var(--si-danger-border); }
.si-finding-ok { color: var(--si-success-text); }

.si-generate-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--si-border); flex-wrap: wrap; }

/* Read-only field display (PublicDocumentView.razor) — same .si-field-grid/.si-cell/.si-field
   layout classes as the edit panel, a plain value box in place of an input. */
.si-field-readonly {
  font-size: 0.85rem; color: #212529; white-space: pre-wrap; word-break: break-word;
  background: #fff; border: 1px solid var(--si-border); border-radius: 6px;
  padding: 6px 10px; min-height: 1.6em;
}
.si-public-doc-title { font-weight: 700; font-size: 1rem; }

/* ── Public upload page (PublicUpload.razor, PublicLayout.razor) ── */
.pub-page { max-width: 900px; margin: 0 auto; }
.pub-content { padding: 1.25rem 1rem 3rem; }
.pub-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.pub-header-icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--si-surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--si-accent); font-size: 1.2rem; flex-shrink: 0;
}
.pub-invalid { text-align: center; padding: 4rem 1rem; color: var(--si-text-muted); }
.pub-invalid i { font-size: 2.4rem; display: block; margin-bottom: 0.75rem; color: var(--si-border-strong); }
@media (max-width: 480px) {
  .pub-content { padding: 1rem 0.75rem 2rem; }
  .si-dropzone { padding: 1rem; }
}

/* ── Legal Opinion panel (Components/Shared/LegalOpinionPanel.razor) ──
   Shared by both the classic File Details page and Smart Intake V2, so these
   rules live in the global stylesheet rather than component-scoped CSS. */
.lop-panel { max-width: 900px; }
.lop-tabstrip { display: flex; gap: 6px; margin-bottom: 12px; }
.lop-tab {
  border: 1px solid var(--si-border); background: #fff; border-radius: 8px; padding: 6px 14px;
  font-size: 0.84rem; font-weight: 500; color: #495057; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.lop-tab:hover { border-color: var(--si-accent); }
.lop-tab.active { background: var(--si-accent); border-color: var(--si-accent); color: #fff; }

.lop-card { border: 1px solid var(--si-border); border-radius: 10px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.lop-card-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--si-surface-2); border-bottom: 1px solid var(--si-border); font-size: 0.86rem; font-weight: 600; }
.lop-card-body { padding: 14px; }
.lop-textarea {
  width: 100%; border: none; padding: 16px; background: var(--si-surface-2); font-family: Arial, sans-serif;
  font-size: 12pt; line-height: 1.6; min-height: 260px; max-height: 500px; resize: vertical; white-space: pre-wrap;
}
.lop-saved-note { padding: 6px 14px; font-size: 0.78rem; color: var(--si-success-text); border-top: 1px solid var(--si-border); }
.lop-lang-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--si-border); margin-bottom: 0; }
.lop-lang-tab {
  border: none; background: none; padding: 7px 12px; font-size: 0.83rem; color: var(--si-text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.lop-lang-tab.active { color: var(--si-accent); border-bottom-color: var(--si-accent); }
.lop-empty { text-align: center; padding: 2rem 1rem; color: var(--si-text-muted); border: 1px dashed var(--si-border); border-radius: 10px; }
.lop-empty i { font-size: 1.6rem; display: block; margin-bottom: 0.4rem; }

