/* [TFH-321:TFH_HOTEL_INVOICE_ENTRY:CSS-START] */
.tfh-hotel-invoice-screen,
.tfh-hotel-invoice-index-screen {
  width: 100vw;
  height: 100dvh;
  position: fixed;
  inset: 0;
  z-index: 49;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 0%,rgba(47,127,196,.13),transparent 29%),
    linear-gradient(135deg,#eaf1f7,#f8fafc 48%,#e7eef5);
}

.tfh-hotel-invoice-body {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}

.tfh-hotel-invoice-form {
  width: min(1580px,100%);
  margin: auto;
  display: grid;
  gap: 13px;
}

.tfh-hotel-invoice-header-card,
.tfh-hotel-invoice-lines-card,
.tfh-hotel-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-hotel-invoice-header-card {
  padding: 14px;
}

.tfh-hotel-invoice-header-grid {
  display: grid;
  grid-template-columns:
    minmax(230px,.9fr)
    minmax(165px,.7fr)
    minmax(260px,1.05fr)
    minmax(300px,1.2fr);
  gap: 12px;
  align-items: end;
}

.tfh-hotel-invoice-party-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

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

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

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

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

[data-tfh-hotel-invoice-clairvoyance]
  .tfh-suggestion-list {
  z-index: 90;
}

.tfh-hotel-invoice-lines-card {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  min-height: 410px;
  padding: 12px;
  border-top: 4px solid var(--tfh-gold-500);
  overflow: hidden;
}

.tfh-hotel-invoice-grid-wrap {
  min-height: 0;
  height: clamp(270px,41vh,440px);
  overflow: auto;
  border: 1px solid var(--tfh-line);
  border-radius: 11px;
  scrollbar-gutter: stable;
}

.tfh-hotel-invoice-grid {
  width: 100%;
  min-width: 1230px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-family: "Segoe UI",Arial,sans-serif;
  font-size: 12pt;
}

.tfh-hotel-invoice-grid th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 52px;
  padding: 9px 6px;
  color: #fff;
  background: linear-gradient(#6f879b,#334d63);
  font-size: 10pt;
  text-align: center;
  vertical-align: middle;
}

.tfh-hotel-invoice-grid th small {
  display: block;
  margin-top: 3px;
  color: rgba(255,255,255,.72);
  font-size: 8pt;
  font-weight: 650;
}

.tfh-hotel-invoice-grid td {
  padding: 6px;
  border-right: 1px solid #e3e9ef;
  border-bottom: 1px solid #e3e9ef;
  vertical-align: top;
}

.tfh-hotel-invoice-grid tr.is-selected td {
  background: #eaf4fc;
}

.tfh-hotel-invoice-grid input,
.tfh-hotel-invoice-grid textarea {
  width: 100%;
  min-height: 38px;
  padding: 5px 6px;
  border: 1px solid #d3dde7;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.tfh-hotel-invoice-grid textarea {
  min-height: 86px;
  height: 86px;
  resize: none;
  line-height: 1.3;
}

.tfh-hotel-invoice-grid th:nth-child(1) {
  width: 44px;
}

.tfh-hotel-invoice-grid th:nth-child(2) {
  width: 235px;
}

.tfh-hotel-invoice-grid th:nth-child(3) {
  width: 380px;
}

.tfh-hotel-invoice-grid th:nth-child(4) {
  width: 330px;
}

.tfh-hotel-invoice-grid th:nth-child(5) {
  width: 210px;
}

.tfh-hotel-line-no {
  padding-top: 25px !important;
  text-align: center;
  font-weight: 850;
}

.tfh-hotel-guest-block,
.tfh-hotel-stay-block,
.tfh-hotel-charges-block {
  display: grid;
  gap: 7px;
}

.tfh-hotel-stay-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.tfh-hotel-stay-block > input,
.tfh-hotel-charges-block input,
.tfh-hotel-charges-block .tfh-inv-readonly-field {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tfh-hotel-charges-block .tfh-inv-readonly-field {
  min-height: 38px;
}

.tfh-hotel-invoice-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 330px;
  gap: 12px;
  padding: 12px;
}
/* [TFH-321:TFH_HOTEL_INVOICE_ENTRY:CSS-END] */
/* [TFH-321:TFH_HOTEL_INVOICE_ENTRY:CSS-GRID-SPACE-START] */
/*
  Hotel 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 #tfhHotelInvoiceScreen: other screens are not affected.
*/
#tfhHotelInvoiceScreen {
  --tfh-inv-ctl-h: 36px;
  --tfh-inv-cell-h: 30px;
  --tfh-inv-grid-line: #d5dee7;
}

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

#tfhHotelInvoiceScreen .tfh-hotel-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) ---------- */
#tfhHotelInvoiceScreen .tfh-hotel-invoice-header-card {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
}

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

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

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

#tfhHotelInvoiceScreen .tfh-hotel-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;
}

#tfhHotelInvoiceScreen .tfh-hotel-invoice-header-card .tfh-invoice-status-button,
#tfhHotelInvoiceScreen .tfh-hotel-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 ---------- */
#tfhHotelInvoiceScreen .tfh-hotel-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;
}

#tfhHotelInvoiceScreen .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);
}

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

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

#tfhHotelInvoiceScreen .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;
}

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

#tfhHotelInvoiceScreen .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 */
#tfhHotelInvoiceScreen .tfh-lg-wrap {
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
}

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

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

/* ---------- Header ---------- */
#tfhHotelInvoiceScreen .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;
}

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

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

#tfhHotelInvoiceScreen .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;
}

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

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

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

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

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

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

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

/* ---------- Rows: all cells top-aligned ---------- */
#tfhHotelInvoiceScreen .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);
}

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

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

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

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

#tfhHotelInvoiceScreen .tfh-lg-table td input,
#tfhHotelInvoiceScreen .tfh-lg-table td select,
#tfhHotelInvoiceScreen .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;
}

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

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

#tfhHotelInvoiceScreen .tfh-lg-table td input:focus,
#tfhHotelInvoiceScreen .tfh-lg-table td select:focus,
#tfhHotelInvoiceScreen .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 */
#tfhHotelInvoiceScreen .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;
}

#tfhHotelInvoiceScreen .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 */
#tfhHotelInvoiceScreen .tfh-lg-table td.tfh-lg-number input,
#tfhHotelInvoiceScreen .tfh-lg-table td.tfh-lg-number .tfh-inv-readonly-field {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

#tfhHotelInvoiceScreen .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 */
#tfhHotelInvoiceScreen .tfh-lg-table th:nth-child(-n+2),
#tfhHotelInvoiceScreen .tfh-lg-table td:nth-child(-n+2) {
  position: sticky;
  z-index: 2;
}

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

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

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

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

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

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

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

#tfhHotelInvoiceScreen .tfh-invoice-totals-card > div,
#tfhHotelInvoiceScreen .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;
}

#tfhHotelInvoiceScreen .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;
}

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

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

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

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

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

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

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

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

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

  #tfhHotelInvoiceScreen .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-321:TFH_HOTEL_INVOICE_ENTRY:CSS-GRID-SPACE-END] */
