/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:CSS-START] */
.tfh-flight-invoice-screen,.tfh-flight-invoice-index-screen{width:100vw;height:100dvh;position:fixed;inset:0;z-index:48;display:grid;grid-template-rows:auto minmax(0,1fr) auto;overflow:hidden;background:linear-gradient(135deg,#eaf1f7,#f8fafc 48%,#e7eef5)}
.tfh-flight-invoice-body{min-height:0;overflow:auto;padding:14px 16px 18px}
.tfh-flight-invoice-form{width:min(1580px,100%);margin:auto;display:grid;gap:13px}
.tfh-flight-invoice-header-card,.tfh-flight-invoice-lines-card,.tfh-flight-invoice-bottom-grid{border:1px solid rgba(17,49,84,.13);border-radius:15px;background:rgba(255,255,255,.97);box-shadow:0 10px 30px rgba(18,52,92,.08)}
.tfh-flight-invoice-header-card{padding:14px}
.tfh-flight-invoice-header-grid{display:grid;grid-template-columns:250px 170px 1fr 1fr;gap:12px;align-items:end}
.tfh-flight-invoice-party-grid{display:grid;grid-template-columns:1.2fr 1fr;gap:12px;margin-top:12px}
.tfh-flight-invoice-lines-card{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-height:400px;padding:12px;border-top:4px solid var(--tfh-gold-500);overflow:hidden}
.tfh-flight-invoice-grid-wrap{min-height:0;height:clamp(265px,40vh,430px);overflow:auto;border:1px solid var(--tfh-line);border-radius:11px;scrollbar-gutter:stable}
.tfh-flight-invoice-grid{width:100%;min-width:1650px;border-collapse:separate;border-spacing:0;table-layout:fixed;font-family:"Segoe UI",Arial,sans-serif;font-size:12pt}
.tfh-flight-invoice-grid th{position:sticky;top:0;z-index:3;padding:9px 6px;color:#fff;background:linear-gradient(#6f879b,#334d63);font-size:10pt;text-align:center}
.tfh-flight-invoice-grid td{padding:4px;border-right:1px solid #e3e9ef;border-bottom:1px solid #e3e9ef;vertical-align:middle}
.tfh-flight-invoice-grid tr.is-selected td{background:#eaf4fc}
.tfh-flight-invoice-grid input,.tfh-flight-invoice-grid textarea,.tfh-flight-invoice-grid select{width:100%;min-height:36px;padding:5px 6px;border:1px solid #d3dde7;border-radius:6px;background:#fff;font:inherit}
.tfh-flight-invoice-grid textarea{min-height:52px;resize:none}
.tfh-flight-invoice-grid th:nth-child(1){width:45px}.tfh-flight-invoice-grid th:nth-child(2){width:180px}.tfh-flight-invoice-grid th:nth-child(3){width:125px}.tfh-flight-invoice-grid th:nth-child(4),.tfh-flight-invoice-grid th:nth-child(7){width:130px}.tfh-flight-invoice-grid th:nth-child(5),.tfh-flight-invoice-grid th:nth-child(8){width:150px}.tfh-flight-invoice-grid th:nth-child(6),.tfh-flight-invoice-grid th:nth-child(9){width:280px}.tfh-flight-invoice-grid th:nth-child(10){width:120px}
.tfh-flight-invoice-grid td.is-financial input{text-align:right}
.tfh-flight-invoice-bottom-grid{display:grid;grid-template-columns:1fr 1fr 330px;gap:12px;padding:12px}
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:CSS-END] */
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:V030-CSS-START] */
.tfh-flight-invoice-header-grid {
  grid-template-columns:
    minmax(230px, .9fr)
    minmax(165px, .7fr)
    minmax(260px, 1.05fr)
    minmax(300px, 1.2fr);
  align-items: end;
}

.tfh-flight-invoice-header-grid .tfh-form-field,
.tfh-flight-invoice-party-grid .tfh-form-field {
  min-width: 0;
}

.tfh-flight-invoice-header-grid input,
.tfh-flight-invoice-party-grid input {
  min-height: 42px;
}

.tfh-flight-project-clear {
  min-width: 76px;
  height: 42px;
}

[data-tfh-flight-invoice-clairvoyance] {
  position: relative;
}

[data-tfh-flight-invoice-clairvoyance]
  .tfh-suggestion-list {
  z-index: 90;
}
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:V030-CSS-END] */
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:CSS-GRID-SPACE-START] */
/*
  Flight Invoice Entry - lines grid layout (2026-09-25) - same rules as Transport 301:
  full monitor width; compact header card; lines grid fills the remaining height and runs
  edge to edge in its card; one row per line with every field in its own column
  (TFH_createLineGrid in 999-common); no clipped values; wrapping text fields grow with
  their content; all cells top-aligned; sortable + user-resizable columns; horizontal totals.
  Scoped to #tfhFlightInvoiceScreen: other screens are not affected.
*/
#tfhFlightInvoiceScreen {
  --tfh-inv-ctl-h: 36px;
  --tfh-inv-cell-h: 30px;
  --tfh-inv-grid-line: #d5dee7;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-body {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 14px;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-form {
  width: 100%;
  max-width: none;
  flex: 1 0 auto;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
}

/* ---------- Header card (same layout, compact) ---------- */
#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-header-grid,
#tfhFlightInvoiceScreen .tfh-flight-invoice-party-grid {
  gap: 9px;
  align-items: end;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card .tfh-form-field {
  gap: 4px;
  min-width: 0;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card .tfh-form-field > span,
#tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid .tfh-form-field > span {
  font-size: .72rem;
  line-height: 1.2;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card input {
  height: var(--tfh-inv-ctl-h);
  min-height: var(--tfh-inv-ctl-h);
  padding: 0 10px;
  border-radius: 7px;
  font-size: .88rem;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card .tfh-invoice-status-button,
#tfhFlightInvoiceScreen .tfh-flight-invoice-header-card .tfh-mode-button {
  min-height: var(--tfh-inv-ctl-h);
  height: var(--tfh-inv-ctl-h);
  padding-top: 0;
  padding-bottom: 0;
}

/* ---------- Lines card: toolbar on top, grid edge to edge below ---------- */
#tfhFlightInvoiceScreen .tfh-flight-invoice-lines-card {
  flex: 1 1 0;
  min-height: 250px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

#tfhFlightInvoiceScreen .tfh-invoice-lines-toolbar {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--tfh-inv-grid-line);
}

#tfhFlightInvoiceScreen .tfh-invoice-lines-title {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
}

#tfhFlightInvoiceScreen .tfh-invoice-lines-title h2 {
  margin: 0;
  color: var(--tfh-navy-850, #0f2c47);
  font-size: 1.02rem;
  line-height: 1.2;
  white-space: nowrap;
}

#tfhFlightInvoiceScreen .tfh-invoice-lines-title .tfh-invoice-grid-summary {
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 3px 12px;
  border: 1px solid #d3dde6;
  border-radius: 999px;
  background: #f4f7fa;
  color: #5b6b7c;
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}

#tfhFlightInvoiceScreen .tfh-invoice-line-actions {
  display: flex;
  gap: 8px;
}

#tfhFlightInvoiceScreen .tfh-invoice-line-actions button {
  min-height: 34px;
  height: 34px;
  padding: 0 14px;
  font-size: .8rem;
}

/* Grid area: no side padding, no reserved scrollbar gutter, no border inside the card */
#tfhFlightInvoiceScreen .tfh-lg-wrap {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
}

#tfhFlightInvoiceScreen .tfh-lg-table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: .84rem;
}

#tfhFlightInvoiceScreen .tfh-lg-table th,
#tfhFlightInvoiceScreen .tfh-lg-table td {
  width: auto;
  min-width: 0;
  max-width: none;
}

/* ---------- Header ---------- */
#tfhFlightInvoiceScreen .tfh-lg-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 40px;
  padding: 0;
  color: #fff;
  font-size: .74rem;
  line-height: 1.15;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  background: linear-gradient(180deg,#566f86,#34495e);
  border-right: 1px solid rgba(255,255,255,.14);
  border-bottom: 1px solid #1f3346;
}

#tfhFlightInvoiceScreen .tfh-lg-table th.tfh-lg-group-a {
  background: linear-gradient(180deg,#3f6a8f,#234766);
}

#tfhFlightInvoiceScreen .tfh-lg-table th.tfh-lg-group-b {
  background: linear-gradient(180deg,#6a5a86,#45375f);
}

#tfhFlightInvoiceScreen .tfh-inv-sort-button {
  width: 100%;
  min-height: 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 12px 3px 8px;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: center;
  background: transparent;
  cursor: pointer;
}

#tfhFlightInvoiceScreen .tfh-inv-sort-button:hover,
#tfhFlightInvoiceScreen .tfh-inv-sort-button.is-active {
  background: rgba(255,255,255,.12);
}

#tfhFlightInvoiceScreen .tfh-inv-sort-label {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

#tfhFlightInvoiceScreen .tfh-inv-sort-arrow {
  flex: 0 0 auto;
  font-size: .62rem;
  line-height: 1;
}

#tfhFlightInvoiceScreen .tfh-inv-sort-button:not(.is-active) .tfh-inv-sort-arrow {
  opacity: .45;
}

/* Column resize handle (right edge of every heading) */
#tfhFlightInvoiceScreen .tfh-inv-col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

#tfhFlightInvoiceScreen .tfh-inv-col-resizer::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 0;
  width: 1px;
  background: rgba(255,255,255,.35);
}

#tfhFlightInvoiceScreen th:hover .tfh-inv-col-resizer::after,
#tfhFlightInvoiceScreen th.is-resizing .tfh-inv-col-resizer::after {
  top: 0;
  bottom: 0;
  width: 3px;
  background: #d8b56e;
}

/* ---------- Rows: all cells top-aligned ---------- */
#tfhFlightInvoiceScreen .tfh-lg-table td {
  height: auto;
  padding: 4px;
  vertical-align: top;
  background: #fff;
  border-right: 1px solid #edf1f5;
  border-bottom: 1px solid var(--tfh-inv-grid-line);
}

#tfhFlightInvoiceScreen .tfh-lg-table tbody tr {
  cursor: pointer;
}

#tfhFlightInvoiceScreen .tfh-lg-table tbody tr:hover td {
  background-color: #f4f8fc;
}

#tfhFlightInvoiceScreen .tfh-lg-table tbody tr.is-selected td {
  background-color: #e9f2fb;
}

#tfhFlightInvoiceScreen .tfh-lg-table td.tfh-lg-group-a { background-color: #f6f9fc; }
#tfhFlightInvoiceScreen .tfh-lg-table td.tfh-lg-group-b { background-color: #f8f7fc; }

#tfhFlightInvoiceScreen .tfh-lg-table td input,
#tfhFlightInvoiceScreen .tfh-lg-table td select,
#tfhFlightInvoiceScreen .tfh-lg-table .tfh-inv-readonly-field {
  width: 100%;
  min-width: 0;
  height: var(--tfh-inv-cell-h);
  min-height: var(--tfh-inv-cell-h);
  margin: 0;
  padding: 0 8px;
  border: 1px solid #b9c7d4;
  border-radius: 6px;
  color: #14283d;
  font-family: inherit;
  font-size: .84rem;
  font-weight: 500;
  line-height: calc(var(--tfh-inv-cell-h) - 2px);
  background-color: #fff;
  box-shadow: none;
}

#tfhFlightInvoiceScreen .tfh-lg-table td select {
  padding-right: 4px;
  cursor: pointer;
}

#tfhFlightInvoiceScreen .tfh-lg-table td input[type="date"] {
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}

#tfhFlightInvoiceScreen .tfh-lg-table td input:focus,
#tfhFlightInvoiceScreen .tfh-lg-table td select:focus,
#tfhFlightInvoiceScreen .tfh-lg-table td textarea:focus {
  outline: none;
  border-color: #2f6a9a;
  box-shadow: 0 0 0 2px rgba(47,106,154,.18);
}

/* Wrapping text fields: grow with their content, can be stretched by hand */
#tfhFlightInvoiceScreen .tfh-lg-table td textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: var(--tfh-inv-cell-h);
  min-height: var(--tfh-inv-cell-h);
  margin: 0;
  padding: 5px 8px;
  border: 1px solid #b9c7d4;
  border-radius: 6px;
  color: #14283d;
  font-family: inherit;
  font-size: .84rem;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
  resize: vertical;
  background: #fff;
}

#tfhFlightInvoiceScreen .tfh-lg-table .tfh-lg-line-no {
  color: #0f2c47;
  line-height: var(--tfh-inv-cell-h);
  text-align: center;
  font-weight: 850;
}

/* Numbers right-aligned */
#tfhFlightInvoiceScreen .tfh-lg-table td.tfh-lg-number input,
#tfhFlightInvoiceScreen .tfh-lg-table td.tfh-lg-number .tfh-inv-readonly-field {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tfhFlightInvoiceScreen .tfh-lg-table .tfh-inv-readonly-field {
  border-color: #d3dde6;
  font-weight: 800;
  background: #f4f7fa;
}

#tfhFlightInvoiceScreen .tfh-lg-table td.tfh-lg-total .tfh-inv-readonly-field {
  color: #7a5a12;
  border-color: #e3cf9f;
  background: #fff8e6;
}

/* First two columns (# and name) fixed on the left while scrolling sideways */
#tfhFlightInvoiceScreen .tfh-lg-table th:nth-child(-n+2),
#tfhFlightInvoiceScreen .tfh-lg-table td:nth-child(-n+2) {
  position: sticky;
  z-index: 2;
}

#tfhFlightInvoiceScreen .tfh-lg-table th:nth-child(-n+2) { z-index: 5; }
#tfhFlightInvoiceScreen .tfh-lg-table th:nth-child(1),
#tfhFlightInvoiceScreen .tfh-lg-table td:nth-child(1) { left: var(--tfh-line-sticky-1, 0px); }
#tfhFlightInvoiceScreen .tfh-lg-table th:nth-child(2),
#tfhFlightInvoiceScreen .tfh-lg-table td:nth-child(2) { left: var(--tfh-line-sticky-2, 46px); }

#tfhFlightInvoiceScreen .tfh-lg-table.is-scrolling-x th:nth-child(2),
#tfhFlightInvoiceScreen .tfh-lg-table.is-scrolling-x td:nth-child(2) {
  box-shadow: 6px 0 8px -6px rgba(15,44,71,.28);
}

#tfhFlightInvoiceScreen .tfh-invoice-grid-empty {
  height: 90px;
  color: #788697;
  text-align: center;
  vertical-align: middle !important;
}

/* ---------- Bottom section: notes + horizontal totals ---------- */
#tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid {
  flex: 0 0 auto;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(420px,1fr);
  align-items: stretch;
  gap: 10px;
  padding: 10px 14px;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid .tfh-form-field {
  gap: 4px;
}

#tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid textarea {
  height: 58px;
  min-height: 58px;
  padding: 6px 10px;
  resize: none;
  font-family: inherit;
  font-size: .86rem;
  line-height: 1.3;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  overflow: visible;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card > div,
#tfhFlightInvoiceScreen .tfh-invoice-totals-card > label {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: end;
  gap: 4px;
  margin: 0;
  padding: 6px 9px;
  border: 1px solid #d6dfe7;
  border-radius: 8px;
  color: #14283d;
  background: #fff;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card span {
  justify-self: start;
  max-width: 100%;
  color: #4b5f73;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: normal;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card strong {
  font-size: .98rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card input {
  width: 100%;
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  text-align: right;
  font-size: .92rem;
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card .is-net {
  border-color: #0f2c47;
  background: linear-gradient(180deg,#24527a,#0f2c47);
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card .is-net span {
  color: rgba(255,255,255,.78);
}

#tfhFlightInvoiceScreen .tfh-invoice-totals-card .is-net strong {
  color: #f1d49a;
}

/* ---------- Smaller screens ---------- */
@media (max-width: 1280px) {
  #tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid {
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  }

  #tfhFlightInvoiceScreen .tfh-invoice-totals-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  #tfhFlightInvoiceScreen .tfh-invoice-lines-toolbar {
    flex-wrap: wrap;
  }
}

@media (max-width: 650px) {
  #tfhFlightInvoiceScreen .tfh-flight-invoice-bottom-grid {
    grid-template-columns: 1fr;
  }

  #tfhFlightInvoiceScreen .tfh-lg-table td:nth-child(-n+2) {
    position: static;
    box-shadow: none;
  }
}

body.tfh-col-resizing,
body.tfh-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:CSS-GRID-SPACE-END] */

/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:TRIP-TYPE-CSS-START] */
/* 2026-09-30: Trip Type toggle (One Way / Round Trip) replaces the Class select. */
#tfhFlightInvoiceScreen .tfh-flight-trip-toggle {
  display: flex;
  width: 100%;
  height: var(--tfh-inv-cell-h);
  min-height: var(--tfh-inv-cell-h);
  padding: 2px;
  gap: 2px;
  border: 1px solid #b9c7d4;
  border-radius: 6px;
  background: #eef2f6;
}

#tfhFlightInvoiceScreen .tfh-flight-trip-option {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  color: #4a5f74;
  font-family: inherit;
  font-size: .76rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  cursor: pointer;
}

#tfhFlightInvoiceScreen .tfh-flight-trip-option:hover:not(.is-active) {
  color: #14283d;
  background: rgba(255,255,255,.7);
}

#tfhFlightInvoiceScreen .tfh-flight-trip-option.is-active {
  color: #fff;
  background: linear-gradient(180deg,#3f6a8f,#234766);
  box-shadow: 0 1px 2px rgba(15,44,71,.25);
}

#tfhFlightInvoiceScreen .tfh-flight-trip-option:focus-visible {
  outline: 2px solid #2f6a9a;
  outline-offset: 1px;
}

/* One Way line: return-leg cells are disabled and muted */
#tfhFlightInvoiceScreen .tfh-lg-table td input:disabled,
#tfhFlightInvoiceScreen .tfh-lg-table td textarea:disabled {
  color: #9aa8b5;
  border-style: dashed;
  border-color: #cdd6df;
  background: #f1f3f6;
  cursor: not-allowed;
}

#tfhFlightInvoiceScreen .tfh-lg-table tr.is-one-way td.tfh-lg-group-b {
  background-image: repeating-linear-gradient(
    135deg, transparent 0 6px, rgba(106,90,134,.05) 6px 12px
  );
}
/* [TFH-311:TFH_FLIGHT_INVOICE_ENTRY:TRIP-TYPE-CSS-END] */
