/* Document intake — the sheet built by js/intake.js.
   Loads after the inline <style> in index.html, so equal-specificity rules here
   win by source order (HANDOFF rule 7). It reuses .ev-form-backdrop,
   .ev-form-card, .ev-form-row, .form-input, .form-select, .form-label, .btn and
   .btn-primary unchanged; everything below is the "what did we find / where
   should it go" card, which nothing existing fits.

   HANDOFF rule 6 is applied at the bottom: --amber is roughly 2:1 as text on
   the light theme's white and #E05A4A is not much better, so anything that is
   READ gets the darkened pair (#9C5C08, #B03A2E). Borders and fills keep the
   flat accent — they are not read. */

.ik-card { max-width: 620px; }

/* ---------- status and messages ---------- */

.ik-status {
  font-size: .85rem;
  line-height: 1.6;
  padding: .9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}
.ik-status-working { color: var(--sand); }
.ik-status-error {
  color: #E05A4A;
  border-color: rgba(224, 90, 74, 0.5);
  background: rgba(224, 90, 74, 0.08);
}
/* Something happened and it was the thing he wanted — the money is in the
   books. Green, and the only place in this sheet that earns it. */
.ik-status-done {
  color: var(--st-booked);
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
}
.ik-status-done strong { color: var(--st-booked); }

/* What attaching this document is about to do to his costs, said before he
   taps. Amber because it is money moving, not because anything is wrong. */
.ik-records {
  font-size: .85rem;
  line-height: 1.6;
  padding: .8rem .9rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 162, 61, 0.45);
  background: rgba(232, 162, 61, 0.08);
  color: var(--sand);
}
.ik-records strong { color: var(--amber); }

/* ---------- the picker ---------- */

.ik-pick { text-align: center; padding: .5rem 0 .25rem; }

.ik-pick-btn {
  display: inline-block;
  cursor: pointer;
  border: 1px dashed var(--amber);
  border-radius: 12px;
  background: rgba(232, 162, 61, 0.08);
  color: var(--amber);
  font-size: .9rem;
  letter-spacing: 1px;
  padding: 1.1rem 1.6rem;
}
.ik-pick-btn:hover { background: rgba(232, 162, 61, 0.14); }

/* The input is inside the label, so the label IS the button. Hidden rather than
   display:none so it stays focusable from the keyboard. */
.ik-pick-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}

.ik-pick-hint {
  margin-top: 1rem;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- what was read ---------- */

.ik-found {
  border: 1px solid var(--glass-border);
  background: var(--glass-white);
  border-radius: 12px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}
.ik-found-title {
  font-family: 'Archivo', sans-serif;
  font-size: .62rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .7rem;
}
.ik-found-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .6rem .9rem;
}
.ik-found-field { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ik-found-label {
  font-size: .62rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.ik-found-value {
  font-size: .88rem;
  color: var(--bone);
  overflow-wrap: anywhere;
}

/* ---------- the lines, and the category each will be saved under ----------

   Added when the reader started assigning categories itself. The one thing this
   list has to make obvious is which categories were READ off the document and
   which the hub guessed, because a guess shown as a reading is a wrong category
   that never gets checked. Read is teal (the app's "this is known" colour);
   guessed is amber, the same amber every other "worth a look" on this card
   uses. Neither is red: a guess is not a fault. */

.ik-lines {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}
.ik-lines-title {
  font-family: 'Archivo', sans-serif;
  font-size: .62rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.ik-lines-sub {
  font-size: .75rem;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: .7rem;
}
.ik-lines-sub:last-child { margin: .7rem 0 0; }

.ik-line {
  padding: .5rem 0;
  border-top: 1px solid var(--glass-border);
}
.ik-line-head {
  display: flex;
  gap: .8rem;
  align-items: baseline;
  justify-content: space-between;
}
.ik-line-desc {
  font-size: .85rem;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.ik-line-amount {
  font-size: .85rem;
  color: var(--bone);
  white-space: nowrap;
}
.ik-line-meta { margin-top: .3rem; }

/* The document's own wording, kept under the readable one wherever the two
   differ. Smaller and quieter, because it is the audit trail and not the label
   — but present, so nothing the document said disappears behind a tidy-up. */
.ik-line-raw {
  margin-top: .25rem;
  font-size: .72rem;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ik-cat {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: .15rem .5rem;
  border: 1px solid transparent;
}
.ik-cat-read {
  color: var(--teal-bright);
  border-color: rgba(31, 163, 158, 0.45);
  background: rgba(31, 163, 158, 0.10);
}
.ik-cat-guess {
  color: var(--amber);
  border-color: rgba(232, 162, 61, 0.45);
  background: rgba(232, 162, 61, 0.10);
}

/* ---------- warnings from the reader ---------- */

.ik-warnings {
  border: 1px solid rgba(232, 162, 61, 0.4);
  background: rgba(232, 162, 61, 0.07);
  border-radius: 10px;
  padding: .7rem .9rem;
  margin-bottom: 1rem;
}
.ik-warnings-title {
  font-family: 'Archivo', sans-serif;
  font-size: .62rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: .4rem;
}
.ik-warning { font-size: .82rem; line-height: 1.55; color: var(--sand); padding: .2rem 0; }

/* ---------- whether the file survived ---------- */

.ik-kept {
  font-size: .8rem;
  line-height: 1.6;
  color: var(--sand);
  border-left: 2px solid var(--teal-bright);
  padding: .5rem 0 .5rem .8rem;
  margin-bottom: 1rem;
}
/* Not kept is the one line on this card he must not skim past: it is only
   actionable — by keeping the paper — while the document is still in his hand. */
.ik-kept-warn {
  color: #E05A4A;
  border-left-color: #E05A4A;
  background: rgba(224, 90, 74, 0.07);
  border-radius: 0 8px 8px 0;
  padding-right: .8rem;
}

.ik-linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--amber);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- notes and near-duplicates ---------- */

.ik-note,
.ik-similar {
  font-size: .8rem;
  line-height: 1.6;
  color: var(--sand);
  background: rgba(232, 162, 61, 0.08);
  border-left: 2px solid var(--amber);
  border-radius: 0 8px 8px 0;
  padding: .6rem .9rem;
  margin-bottom: .8rem;
}

/* ---------- the destinations ---------- */

.ik-dest-title {
  font-family: 'Archivo', sans-serif;
  font-size: .62rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.2rem 0 .7rem;
}

.ik-dest {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--charcoal-soft);
  padding: .85rem 1rem;
  margin-bottom: .7rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
button.ik-dest:hover { border-color: rgba(232, 162, 61, 0.45); background: var(--glass-white); }

/* The one that closes the profit hole, and the one he wants nine times in ten. */
.ik-dest-primary { border-color: rgba(232, 162, 61, 0.5); background: rgba(232, 162, 61, 0.08); }
button.ik-dest-primary:hover { border-color: var(--amber); }

/* A destination that is not available. A <div>, not a disabled button: it
   carries a real explanation and must stay readable and selectable. */
.ik-dest-blocked { cursor: default; opacity: .95; border-style: dashed; }

.ik-dest-name {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--bone);
  margin-bottom: .3rem;
}
.ik-dest-primary .ik-dest-name { color: var(--amber); }
.ik-dest-blocked .ik-dest-name { color: var(--muted); }

.ik-dest-sub {
  display: block;
  font-size: .78rem;
  line-height: 1.6;
  color: var(--muted);
}

.ik-dest-list { margin: .5rem 0 0; padding-left: 1.1rem; }
.ik-dest-list li { margin-bottom: .25rem; }

/* ---------- filing form ---------- */

.ik-err {
  font-size: .82rem;
  line-height: 1.55;
  color: #E05A4A;
  margin-top: .8rem;
}
.ik-err:empty { display: none; }

.ik-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.2rem;
}

/* ---------- light theme (HANDOFF rule 6) ---------- */

body.light-theme .ik-pick-btn { color: #9C5C08; }
body.light-theme .ik-pick-hint { color: #6B6355; }
body.light-theme .ik-found { background: rgba(0, 0, 0, 0.02); border-color: rgba(0, 0, 0, 0.12); }
body.light-theme .ik-found-value { color: #241F19; }
body.light-theme .ik-warnings-title { color: #9C5C08; }
body.light-theme .ik-warning { color: #3A342B; }
body.light-theme .ik-kept { color: #3A342B; }
body.light-theme .ik-kept-warn { color: #B03A2E; }
body.light-theme .ik-linkbtn { color: #9C5C08; }
body.light-theme .ik-note,
body.light-theme .ik-similar { color: #3A342B; }
body.light-theme .ik-lines { background: rgba(0, 0, 0, 0.02); border-color: rgba(0, 0, 0, 0.12); }
body.light-theme .ik-line { border-top-color: rgba(0, 0, 0, 0.10); }
body.light-theme .ik-line-desc,
body.light-theme .ik-line-amount { color: #241F19; }
body.light-theme .ik-lines-sub,
body.light-theme .ik-line-raw { color: #6B6355; }
/* HANDOFF rule 6, applied to both chips. Raw amber is ~2:1 as text on white and
   --teal-bright is not much better at ~2.6:1; the fills and borders stay as they
   are, since neither is read. #0E5F66 is the brand's own Deep Ocean. */
body.light-theme .ik-cat-guess { color: #9C5C08; }
body.light-theme .ik-cat-read { color: #0E5F66; }
body.light-theme .ik-status-working { color: #3A342B; }
body.light-theme .ik-status-error { color: #B03A2E; }
body.light-theme .ik-err { color: #B03A2E; }
body.light-theme .ik-dest { background: rgba(0, 0, 0, 0.02); border-color: rgba(0, 0, 0, 0.12); }
body.light-theme .ik-dest-name { color: #241F19; }
body.light-theme .ik-dest-primary .ik-dest-name { color: #9C5C08; }
body.light-theme .ik-dest-sub { color: #6B6355; }

/* ---------- phone ---------- */

@media (max-width: 640px) {
  .ik-found-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ik-actions { flex-direction: column-reverse; }
  .ik-actions .btn { width: 100%; }
}

/* ---------------------------------------------------------------------------
   ikSay — messages that used to be browser alerts
   ---------------------------------------------------------------------------
   Each paragraph is its own line rather than one block of text joined by \n\n,
   which an alert renders as a blank line and HTML does not render at all. The
   two-paragraph shape matters: the first says what happened, the second says
   what it means for his books.
   --------------------------------------------------------------------------- */
.ik-say-line {
  margin: 0 0 0.7rem;
  line-height: 1.55;
}
.ik-say-line:last-child { margin-bottom: 0; }

/* `warn` was used by ikSay for the two messages that are not failures — an
   invoice already counted, and one with no priced lines. Both are "nothing was
   done, and that is correct", so amber rather than red: a red panel for a
   working safeguard teaches him to distrust red. */
.ik-status-warn {
  color: var(--amber);
  border-color: rgba(232, 162, 61, 0.5);
  background: rgba(232, 162, 61, 0.08);
}
body.light-theme .ik-status-warn {
  /* Raw amber is ~2:1 as text on white — HANDOFF rule 6. The border and the
     tint are fills and need no override; only the text does. */
  color: #9C5C08;
}

/* Same rule for the two blocks added with "attaching records the cost": the
   amber inside them is read, so it darkens; the borders and tints do not. */
body.light-theme .ik-records strong { color: #9C5C08; }
body.light-theme .ik-status-done,
body.light-theme .ik-status-done strong { color: #15803D; }
