/* Travel Expense Claim module.
   Loaded alongside index.html's inline styles and reusing its tokens, so the
   two modules cannot drift apart on colour or spacing. Brand reference:
   Petrol #003D44, Green #48822A, Lime #C1FA00. */

:root {
  --petrol: #003D44;
  --green:  #48822A;
  --lime:   #C1FA00;
}

.exp-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.exp-head h2 { margin: 0; font-size: 18px; color: var(--petrol); }
.exp-head .spacer { margin-inline-start: auto; }

.exp-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.exp-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.exp-card .k { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.exp-card .v { font-size: 20px; font-weight: 700; color: var(--petrol); margin-top: 4px; }
.exp-card.alert .v { color: var(--green); }

.exp-section {
  border: 1px solid var(--border); border-radius: 10px; margin: 14px 0; background: #fff;
}
.exp-section > summary {
  cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: 13.5px; color: var(--petrol);
  list-style: none; display: flex; align-items: center; gap: 10px;
}
.exp-section > summary::-webkit-details-marker { display: none; }
.exp-section > summary::before { content: "\25B8"; color: var(--muted); transition: transform .15s; }
.exp-section[open] > summary::before { transform: rotate(90deg); }
.exp-section .body { padding: 0 14px 14px; }
.exp-section .sec-total { margin-inline-start: auto; font-weight: 600; color: var(--green); font-size: 12.5px; }

/* Line tables. Wide on a desktop, stacked cards on a phone: an expense row has
   eight columns and no amount of horizontal scrolling makes that usable at
   390px. */
.lines { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lines th {
  text-align: start; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--border); font-weight: 700;
}
.lines td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines input, .lines select { width: 100%; min-width: 0; padding: 6px 7px; font-size: 12.5px; }
.lines td.num input { text-align: end; }
.lines tfoot td { font-weight: 700; color: var(--petrol); border-bottom: none; padding-top: 8px; }
.line-del {
  background: none; border: 0; color: var(--red, #b42318); cursor: pointer; font-size: 16px; padding: 2px 6px;
}
.chip {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.chip.ai      { background: #eef4ff; color: #1d4ed8; }
.chip.manual  { background: #eef4f5; color: var(--petrol); }
.chip.review  { background: #fff4e0; color: #92600a; }
.chip.ok      { background: #eaf6e6; color: var(--green); }

.totals-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.totals-grid .t { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fbfcfd; }
.totals-grid .t .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.totals-grid .t .v { font-size: 16px; font-weight: 700; color: var(--petrol); }
.totals-grid .t.grand { background: var(--petrol); border-color: var(--petrol); }
.totals-grid .t.grand .k { color: rgba(255,255,255,.75); }
.totals-grid .t.grand .v { color: #fff; }
.totals-grid .t.due  { background: var(--lime); border-color: var(--lime); }
.totals-grid .t.due .k { color: rgba(0,61,68,.7); }
.totals-grid .t.due .v { color: var(--petrol); }
.words { margin-top: 8px; font-size: 12px; color: var(--muted); font-style: italic; }

.drop {
  border: 2px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center;
  background: #fbfcfd;
}
.drop.over { border-color: var(--green); background: #f2f9ef; }
.drop .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.drop-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li { padding: 8px 0 8px 16px; border-inline-start: 2px solid var(--border); position: relative; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: -5px; top: 13px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
}
.timeline .when { color: var(--muted); font-size: 11.5px; }

.err-list { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.err-list ul { margin: 6px 0 0; padding-inline-start: 18px; }
input.field-err, select.field-err, textarea.field-err {
  border-color: #dc2626 !important;
  background: #fef2f2;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.rcpt-preview { width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 8px; }
.rcpt-img { width: 100%; border: 1px solid var(--border); border-radius: 8px; }

@media (max-width: 780px) {
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines tr { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-bottom: 10px; }
  .lines td { border: none; padding: 4px 0; }
  .lines td::before {
    content: attr(data-label); display: block; font-size: 10px; text-transform: uppercase;
    letter-spacing: .5px; color: var(--muted); margin-bottom: 2px;
  }
  .lines tfoot { display: block; }
  .lines tfoot tr { border: none; }
  .exp-head .spacer { margin-inline-start: 0; width: 100%; }
}

/* ---- Receipt reading progress ---------------------------------------
   A batch of phone photographs can take half a minute. A bar with a count
   and a per file line says what is happening; a spinner with no end in
   sight reads as a hang. */
.rcpt-prog { margin-top: 12px; }
.rcpt-prog .bar {
  height: 8px; border-radius: 999px; background: #e6ebec; overflow: hidden;
}
.rcpt-prog .bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green, #48822A), var(--lime, #C1FA00));
  transition: width .3s ease;
}
.rcpt-prog-text {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
.rcpt-files { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; }
.rcpt-files li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; border-bottom: 1px solid var(--border); color: var(--muted);
}
.rcpt-files li .nm {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rcpt-files li .st { white-space: nowrap; }
.rcpt-files li.ok  .st { color: var(--green, #48822A); font-weight: 600; }
.rcpt-files li.bad .st { color: var(--red, #b42318); font-weight: 600; }

/* ---- Admin controls, People table ------------------------------------
   Six columns, related fields stacked inside each, so the whole table fits a
   normal window without sideways scrolling. The scroll wrapper stays only as
   a fallback for genuinely narrow windows. */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.people { min-width: 860px; }
.people th { white-space: nowrap; vertical-align: bottom; line-height: 1.3; }
.people td { padding: 10px 8px; }
.people td:first-child { min-width: 200px; }
.people .stack { display: grid; gap: 6px; }
.people select, .people input[type="text"], .people input[type="number"] {
  width: 100%; min-width: 0;
}
.people .mini {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
}
.people .mini input { flex: 1; }
.people .ticks label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink, #1c2330); cursor: pointer; white-space: nowrap;
}
.people input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--green, #48822A); flex: none;
}
.people .btn-sm { justify-self: start; }

@media (max-width: 780px) {
  .people { min-width: 0; }
  .people td::before { display: none; }  /* the stacks label themselves */
}

.people .btn-sm.danger { color: #b42318; border-color: #f3c9c4; }
.people .btn-sm.danger:hover { background: #fef2f2; }
