/* ABOUTME: Styles for the extraction demo, built on the Laserfiche identity tokens sampled in */
/* ABOUTME: docs/design/mcp/research/laserfiche-doc-viewer-style-reference.md (navy bar, orange tabs, action blue). */
:root {
  --lf-navy: #01426A;
  --lf-accent-orange: #E35205;
  --lf-action-blue: #0069BA;
  --lf-chrome: #FAFAFA;
  --lf-canvas: #F3F3F3;
  --lf-page: #FFFFFF;
  --lf-page-outline: #87CEEB;
  --lf-text: #000000;
  --lf-text-secondary: #666666;
  --lf-text-inactive: #6F6F6F;
  --lf-border-input: #CCCCCC;
  --lf-input-fill: #EEEEEE;
  --lf-row-selected: #E8EFF6;
  --lf-grid-header: #E2E2E2;
  --lf-btn-secondary-fill: #E2E8EF;
  --lf-btn-secondary-text: #333333;
  --lf-chip-fill: #E8EFF6;
  --lf-chip-border: #C9CFD6;
  --lf-readonly-tint: #F7EECF;
  --lf-readonly-icon: #F6BF0D;
  --lf-modal-hairline: #E0E0E0;
  --lf-modal-title: #606060;
  --ok: #1E7B34;
  --ok-fill: #E6F4EA;
  --bad: #B3261E;
  --bad-fill: #FBE9E7;
  --warn-fill: #FFF4D6;
  --s1: #0069BA;
  --llm: #6B4FA0;
  --highlight: #FFE58A;
  --highlight-active: #FFC93C;
  --lf-font: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "DejaVu Sans Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--lf-font);
  font-size: 14px;
  color: var(--lf-text);
  background: var(--lf-canvas);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* App bar */
.appbar {
  height: 44px;
  background: var(--lf-navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar .mark { width: 22px; height: 22px; border-radius: 3px; background: var(--lf-accent-orange); flex: 0 0 auto; }
.appbar .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .subtitle { opacity: .8; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .spacer { flex: 1; }
.appbar .spend { font-size: 13px; opacity: .92; white-space: nowrap; }
.appbar button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .5);
  color: #fff;
  border-radius: 3px;
  padding: 3px 10px;
  cursor: pointer;
}
.appbar button:hover { background: rgba(255, 255, 255, .12); }

/* Counter strip */
.counters {
  background: var(--lf-chrome);
  border-bottom: 1px solid var(--lf-border-input);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
}
/* Two columns, never three, so each System One counter stays beside its LLM counter. */
@media (max-width: 1100px) {
  .counters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counter:nth-child(even) { border-right: none; }
  .counter { border-bottom: 1px solid var(--lf-modal-hairline); }
}
.counter { padding: 10px 16px; border-right: 1px solid var(--lf-modal-hairline); min-width: 0; }
.counter:last-child { border-right: none; }
.counter .k { font-size: 12px; color: var(--lf-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.counter .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; }
.counter .v.s1 { color: var(--s1); }
.counter .v.llm { color: var(--llm); }
.counter .d { font-size: 12px; color: var(--lf-text-secondary); overflow-wrap: anywhere; }
.counter .d button { border: none; background: none; color: var(--lf-action-blue); padding: 0; cursor: pointer; font-size: 12px; font-weight: 600; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) minmax(560px, 1.15fr);
  min-height: calc(100vh - 44px - 72px);
}
@media (max-width: 1280px) {
  .layout { grid-template-columns: 280px minmax(0, 1fr); }
  .results { grid-column: 1 / -1; border-left: none !important; border-top: 1px solid var(--lf-border-input); }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { border-right: none !important; border-bottom: 1px solid var(--lf-border-input); }
  .appbar .subtitle, .appbar .spend { display: none; }
}

/* Left rail */
.rail { background: var(--lf-chrome); border-right: 1px solid var(--lf-border-input); padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.section-title { font-weight: 700; font-size: 13px; color: var(--lf-text-secondary); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
.scenarios { display: flex; flex-direction: column; gap: 6px; }
.scenario {
  text-align: left;
  border: 1px solid var(--lf-chip-border);
  background: var(--lf-page);
  border-radius: 3px;
  padding: 8px 10px;
  cursor: pointer;
}
.scenario:hover { border-color: var(--lf-action-blue); }
.scenario[aria-pressed="true"] { background: var(--lf-row-selected); border-color: var(--lf-action-blue); box-shadow: inset 3px 0 0 var(--lf-accent-orange); }
.scenario .name { font-weight: 600; display: block; }
.scenario .blurb { font-size: 12px; color: var(--lf-text-secondary); display: block; margin-top: 2px; }

.tabs { display: flex; border-bottom: 1px solid var(--lf-border-input); flex-wrap: wrap; }
.tab {
  padding: 7px 10px 4px;
  font-weight: 700;
  color: var(--lf-text-inactive);
  border: none;
  border-bottom: 3px solid transparent;
  background: none;
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--lf-text); border-bottom-color: var(--lf-accent-orange); }
.tab:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--lf-action-blue); outline-offset: 1px; }

.source-panel { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.source-panel textarea { width: 100%; min-height: 160px; resize: vertical; }
.hint { font-size: 12px; color: var(--lf-text-secondary); margin: 0; }
.drop {
  border: 2px dashed var(--lf-chip-border);
  border-radius: 4px;
  padding: 14px;
  text-align: center;
  background: var(--lf-page);
  color: var(--lf-text-secondary);
}
.drop.over { border-color: var(--lf-action-blue); background: var(--lf-row-selected); }

.control { display: flex; flex-direction: column; gap: 3px; }
.control label, .control .label { font-size: 13px; color: var(--lf-text-secondary); font-weight: 600; }
.control.inline { flex-direction: row; align-items: center; gap: 8px; }
#schema-control { margin-top: 14px; }
#schema-control .btn { align-self: flex-start; }
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  background: var(--lf-page);
  border: 1px solid var(--lf-border-input);
  border-radius: 2px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
  padding: 5px 7px;
  min-width: 0;
  max-width: 100%;
}
textarea { font-family: var(--mono); font-size: 12.5px; }
.segmented { display: flex; border: 1px solid var(--lf-border-input); border-radius: 3px; overflow: hidden; }
.segmented button { flex: 1; border: none; background: var(--lf-page); padding: 5px 6px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--lf-border-input); }
.segmented button:last-child { border-right: none; }
.segmented button[aria-pressed="true"] { background: var(--lf-action-blue); color: #fff; font-weight: 600; }

.btn {
  border: none;
  border-radius: 2px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  min-height: 30px;
}
.btn.primary { background: var(--lf-action-blue); color: #fff; }
.btn.primary:hover { background: #005aa0; }
.btn.primary:disabled { background: #8bb6db; cursor: progress; }
.btn.secondary { background: var(--lf-btn-secondary-fill); color: var(--lf-btn-secondary-text); border-radius: 3px; }
.btn.secondary:hover { background: #d3dce6; }
.btn.link { background: none; color: var(--lf-action-blue); padding: 0; min-height: 0; }
.run-row { display: flex; gap: 8px; align-items: center; }
.run-row .btn.primary { flex: 1; min-height: 38px; font-size: 15px; }

/* Document viewer */
.viewer { display: flex; flex-direction: column; min-width: 0; }
.viewer-bar {
  height: 39px;
  background: var(--lf-chrome);
  border-bottom: 1px solid var(--lf-border-input);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}
.viewer-bar .doc-title { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-bar .doc-meta { font-size: 12px; color: var(--lf-text-secondary); white-space: nowrap; }
.canvas { flex: 1; overflow: auto; padding: 14px; display: flex; justify-content: center; align-items: flex-start; }
.page {
  background: var(--lf-page);
  outline: 4px solid var(--lf-page-outline);
  max-width: 760px;
  width: 100%;
  padding: 22px 20px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.page.image { padding: 0; font-family: var(--lf-font); white-space: normal; }
.page.image img { display: block; width: 100%; height: auto; }
.page .empty { color: var(--lf-text-inactive); font-family: var(--lf-font); white-space: normal; }
mark { background: var(--highlight); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.active { background: var(--highlight-active); box-shadow: 0 0 0 2px var(--lf-accent-orange); }

/* Results */
.results { border-left: 1px solid var(--lf-border-input); background: var(--lf-chrome); display: flex; flex-direction: column; min-width: 0; }
.verdict {
  padding: 10px 14px;
  border-bottom: 1px solid var(--lf-border-input);
  background: var(--lf-page);
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
}
.verdict .big { font-size: 16px; font-weight: 700; }
.verdict .big.s1 { color: var(--s1); }
.verdict:empty { display: none; }
.sides { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.sides.single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) { .sides { grid-template-columns: minmax(0, 1fr); } .side { border-right: none; border-bottom: 1px solid var(--lf-border-input); } }
.side { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--lf-border-input); }
.side:last-child { border-right: none; }
.side-head { padding: 10px 12px 6px; background: var(--lf-chrome); border-top: 4px solid var(--s1); }
.side.llm .side-head { border-top-color: var(--llm); }
.side-head .who { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.side-head .model { font-weight: 400; font-size: 12px; color: var(--lf-text-secondary); }
.side-head .stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; font-variant-numeric: tabular-nums; }
.side-head .stat .n { font-size: 18px; font-weight: 600; }
.side-head .stat .u { font-size: 12px; color: var(--lf-text-secondary); margin-left: 3px; }
.side-head .status { font-size: 12px; color: var(--lf-text-secondary); margin-top: 2px; min-height: 16px; }
.side-head .status.error { color: var(--bad); font-weight: 600; }
.side .tabs { background: var(--lf-chrome); padding: 0 6px; }
.side-body { padding: 10px 12px 16px; overflow-y: auto; flex: 1; }
.placeholder { color: var(--lf-text-inactive); padding: 20px 4px; }

.field-block { margin-bottom: 12px; }
.field-block .field-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--lf-text-secondary); margin-bottom: 3px; font-weight: 600; }
.field-block .field-label .ftype { font-weight: 400; font-size: 11px; color: var(--lf-text-inactive); border: 1px solid var(--lf-modal-hairline); border-radius: 8px; padding: 0 6px; }
.field-block .field-label .grow { flex: 1; }
.field-input {
  font-size: 15px;
  background: var(--lf-input-fill);
  border: 1px solid var(--lf-border-input);
  border-radius: 2px;
  padding: 6px 9px;
  min-height: 33px;
  overflow-wrap: anywhere;
  cursor: default;
}
.field-input.empty { color: var(--lf-text-inactive); font-style: italic; }
.field-input.select { padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--lf-text-inactive) 50%), linear-gradient(135deg, var(--lf-text-inactive) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-block.match .field-input { border-color: #9BC9A6; }
.field-block.mismatch .field-input, .field-block.missed .field-input, .field-block.unexpected .field-input { border-color: #E3A39E; background-color: var(--bad-fill); }
.field-block[data-spans]:hover .field-input, .field-block.focus .field-input { box-shadow: 0 0 0 2px var(--highlight-active); }
.field-sub { font-size: 12px; color: var(--lf-text-secondary); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.field-sub .problem { color: #8A5A00; background: var(--warn-fill); border-radius: 3px; padding: 0 5px; }
.field-sub .diff { color: var(--lf-accent-orange); font-weight: 600; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; white-space: nowrap; }
.badge.ok { background: var(--ok-fill); color: var(--ok); }
.badge.bad { background: var(--bad-fill); color: var(--bad); }
.badge.conf { background: var(--lf-chip-fill); color: #23415A; }
.badge.conf.low { background: var(--warn-fill); color: #8A5A00; }
.badge.none { background: var(--lf-input-fill); color: var(--lf-text-inactive); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 24px;
  background: var(--lf-chip-fill);
  border: 1px solid var(--lf-chip-border);
  font-size: 13px;
}
.tag-chip.off { background: transparent; color: var(--lf-text-inactive); border-style: dashed; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.tag-chip.mismatch, .tag-chip.missed, .tag-chip.unexpected { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.tag-chip .p { font-size: 11px; color: var(--lf-text-secondary); font-variant-numeric: tabular-nums; }

.detail-row { display: flex; gap: 10px; margin-bottom: 9px; }
.detail-row .label { flex: 0 0 120px; color: var(--lf-text-secondary); }
.detail-row .value { min-width: 0; overflow-wrap: anywhere; }
.detail-row .value.link { color: var(--lf-action-blue); font-weight: 600; }

table.usage { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.usage th { background: var(--lf-grid-header); text-align: left; padding: 5px 6px; font-weight: 600; }
table.usage td { padding: 5px 6px; border-bottom: 1px solid var(--lf-modal-hairline); }
table.usage td.n, table.usage th.n { text-align: right; }
pre.raw { font-family: var(--mono); font-size: 12px; background: var(--lf-page); border: 1px solid var(--lf-border-input); padding: 8px; overflow: auto; max-height: 60vh; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; }

.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--lf-chip-border); border-top-color: var(--lf-action-blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.banner { background: var(--warn-fill); border-bottom: 1px solid #E8D38F; padding: 8px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.banner.error { background: var(--bad-fill); border-color: #E3A39E; color: var(--bad); }
.banner button { margin-left: auto; }

/* Schema editor modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; }
.modal { background: var(--lf-chrome); border: 1px solid rgba(0, 0, 0, .2); box-shadow: rgba(0, 0, 0, .5) 0 5px 15px; width: min(1040px, 100%); display: flex; flex-direction: column; max-height: calc(100vh - 60px); }
.modal-head, .modal-foot { padding: 14px 24px; display: flex; align-items: center; gap: 10px; }
.modal-head { border-bottom: 1px solid var(--lf-modal-hairline); }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 600; color: var(--lf-modal-title); flex: 1; }
.modal-foot { border-top: 1px solid var(--lf-modal-hairline); justify-content: flex-end; }
.modal-foot .error { color: var(--bad); margin-right: auto; font-weight: 600; }
.modal-body { padding: 12px 24px; overflow-y: auto; flex: 1; }
.modal-body .tabs { margin-bottom: 10px; }
.editor-list { display: flex; flex-direction: column; gap: 8px; }
.editor-row { background: var(--lf-page); border: 1px solid var(--lf-modal-hairline); border-radius: 3px; padding: 8px; display: grid; gap: 6px 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-items: end; }
.editor-row .wide { grid-column: span 2; }
.editor-row .full { grid-column: 1 / -1; }
.editor-row .control input, .editor-row .control select { width: 100%; }
.editor-row .remove { justify-self: end; color: var(--bad); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.checks label { display: inline-flex; gap: 4px; align-items: center; }
.modal-body textarea.json { width: 100%; min-height: 50vh; }

/* Login */
.login-wrap { min-height: calc(100vh - 44px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { background: var(--lf-chrome); border: 1px solid rgba(0, 0, 0, .2); box-shadow: rgba(0, 0, 0, .2) 0 5px 15px; width: min(420px, 100%); }
.login h1 { margin: 0; padding: 18px 24px; font-size: 20px; font-weight: 600; color: var(--lf-modal-title); border-bottom: 1px solid var(--lf-modal-hairline); }
.login form { padding: 18px 24px 22px; display: flex; flex-direction: column; gap: 12px; }
.login input { width: 100%; padding: 8px 10px; }
.login .error { color: var(--bad); font-weight: 600; margin: 0; }
.login p { margin: 0; color: var(--lf-text-secondary); font-size: 13px; }
