/* Case workspace. Shares the palette declared in chat.css. */

.ws { min-height: 100vh; display: flex; flex-direction: column; }

.ws-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(20px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(18px);
}
.ws-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ws-title h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.ws-title small { color: var(--muted); font-size: 11px; }
.ws-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.ws-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 0 max(20px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--line);
}
.ws-tab {
  border: 0; background: none; padding: 12px 14px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.ws-tab[aria-selected='true'] { color: var(--forest); border-bottom-color: var(--forest); }
.ws-tab .tab-count {
  margin-left: 6px; padding: 1px 6px; border-radius: 9px;
  background: var(--soft); font-size: 11px; font-variant-numeric: tabular-nums;
}

.ws-body {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 28px;
  padding: 24px max(20px, calc((100vw - 1320px) / 2)) 80px;
  align-items: start;
}
.ws-main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }

.ws-card {
  border: 1px solid var(--line); border-radius: 12px; background: white;
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.ws-card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ws-card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ws-card h2 .chapter { margin-right: 8px; color: var(--muted); font-weight: 500; font-size: 12px; }
.ws-card p.hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.field-grid { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px; align-items: start; }
.field-row > label { padding-top: 8px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.field-row .req { color: #b4552f; margin-left: 3px; }
.field-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-row input, .field-row select, .field-row textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: 13.5px;
}
.field-row textarea { min-height: 66px; resize: vertical; }
.field-row input:focus, .field-row select:focus, .field-row textarea:focus {
  outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px #153f3518;
}
.field-meta { margin-top: 4px; color: var(--muted); font-size: 11px; display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* source rows — the guided-capture screen */
.source-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.source-row.is-verified { border-color: #b9d8c4; background: #f6fbf7; }
.source-row.is-blocked { border-color: #e6d3cb; }
.source-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.source-head strong { font-size: 14px; font-weight: 600; }
.source-head .owner { color: var(--muted); font-size: 11.5px; margin-left: 8px; font-weight: 400; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.chip-verified { background: #d9edE0; color: #256346; }
.chip-pending { background: var(--soft); color: var(--muted); }
.chip-manual { background: #fdf0da; color: #8a6314; }
.chip-blocked { background: #f8e2dc; color: #97402f; }
.chip-fee { background: #e8eef8; color: #2d4b7c; }
.chip-auto { background: #e2eef0; color: #1f5a63; }

.source-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ws-button {
  border: 1px solid var(--line); background: white; color: var(--ink);
  border-radius: 7px; padding: 7px 13px; font-size: 13px; font-weight: 500;
}
.ws-button:hover:not(:disabled) { border-color: var(--forest); color: var(--forest); }
.ws-button:disabled { opacity: .5; cursor: not-allowed; }
.ws-button.primary { background: var(--forest); border-color: var(--forest); color: white; }
.ws-button.primary:hover:not(:disabled) { background: #1b5245; color: white; }
.ws-button.subtle { border-color: transparent; color: var(--muted); padding: 7px 8px; }

.capture-box { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--line); }
.capture-box textarea {
  width: 100%; min-height: 76px; resize: vertical; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font: inherit; font-size: 13px;
}
.capture-expected { display: flex; flex-wrap: wrap; gap: 6px; }
.capture-expected span { font-size: 11px; color: var(--muted); background: var(--soft); border-radius: 5px; padding: 2px 7px; }

/* right rail */
.ws-rail { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.rail-card { border: 1px solid var(--line); border-radius: 12px; background: white; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rail-card h3 { margin: 0; font-size: 13px; font-weight: 600; }
.rail-stat { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.rail-stat strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.progress { height: 5px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--forest); transition: width .3s; }
.rail-list { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

/* verdict */
.verdict { border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.verdict.red { background: #fbeae5; color: #8c3524; }
.verdict.amber { background: #fdf2dc; color: #7d5a12; }
.verdict.unknown { background: var(--soft); color: var(--muted); }
.verdict.green { background: var(--mint); color: #1f5c3f; }
.verdict strong { font-size: 15px; }
.flag-list { display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.flag:last-child { border-bottom: 0; }
.flag .level { font-size: 11px; font-weight: 600; padding-top: 2px; }
.flag .level.red { color: #a8412c; }
.flag .level.amber { color: #8a6314; }
.flag .level.unknown { color: var(--muted); }
.flag .level.info { color: #2d4b7c; }
.flag strong { display: block; margin-bottom: 2px; }
.flag p { margin: 0; color: var(--muted); line-height: 1.6; }

/* audit + statement tables */
.ws-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ws-table th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap;
}
.ws-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.55; }
.ws-table tr:last-child td { border-bottom: 0; }
.ws-table td.outstanding { color: var(--muted); }
.table-scroll { overflow-x: auto; }

.blocker-list { display: flex; flex-direction: column; gap: 6px; }
.blocker { display: flex; gap: 8px; font-size: 12.5px; color: #8a4a34; }

.ws-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* case list */
.case-list { display: flex; flex-direction: column; gap: 10px; }
.case-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  background: white; color: inherit; text-decoration: none;
}
.case-item:hover { border-color: var(--forest); }
.case-item strong { font-size: 14px; }
.case-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }

.intake { display: flex; flex-direction: column; gap: 12px; max-width: 620px; }
.intake input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); font: inherit; font-size: 14px;
}
.intake input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px #153f3518; }

.notice { border-left: 3px solid #c98b3f; background: #fdf6e9; padding: 11px 13px; border-radius: 0 7px 7px 0; font-size: 12.5px; line-height: 1.65; color: #6f5216; }
.notice.legal { border-left-color: #7c8ea8; background: #eff3f8; color: #38495f; }

@media (max-width: 1080px) {
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  .ws-rail { position: static; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .field-row > label { padding-top: 0; }
}

@media print {
  .ws-header, .ws-tabs, .ws-rail, .ws-actions, .source-actions, .capture-box, .ws-button { display: none !important; }
  .ws-body { display: block; padding: 0; }
  .ws-card { border: 0; padding: 0 0 18px; break-inside: avoid; }
  .ws-table { font-size: 11px; }
  .source-row { break-inside: avoid; }
}
