/* =====================================================================
   Al Qafla — design system.

   Rules this file holds to:
     · One accent (--a). It marks the primary action and the active nav item.
       Nothing else is accent-coloured.
     · Colour otherwise appears only on data: statuses and signed amounts.
     · One radius scale, one type scale, one spacing scale.
     · Hairline borders, never glow shadows.
   All selectors are uch- prefixed.
   ===================================================================== */

:root {
  /* Surfaces & text */
  --canvas:      #f7f7f6;
  --surface:     #ffffff;
  --surface-2:   #fbfbfa;
  --line:        #e7e7e3;
  --line-strong: #d6d6d1;
  --ink:         #1a1a19;
  --ink-2:       #5f5f5b;
  --ink-3:       #92928c;

  /* The one accent */
  --a:        #0f6b4f;
  --a-hover:  #0c5740;
  --a-soft:   #eef4f1;

  /* Semantic — data only, kept muted */
  --pos:      #15803d;  --pos-soft: #eef7f0;
  --warn:     #b45309;  --warn-soft:#fdf5e9;
  --neg:      #b4342a;  --neg-soft: #fcefee;

  /* Radius */
  --r:    6px;
  --r-lg: 10px;

  /* Spacing scale: 4 8 12 16 24 32 48 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  /* Type */
  --t-title:   17px;
  --t-body:    13px;
  --t-meta:    12px;
  --t-section: 11px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* An author `display` rule beats the UA sheet's [hidden] rule, so state it
   explicitly — otherwise el.hidden silently does nothing on .uch-f, tfoot, etc. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body.uch-body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Icons ------------------------------------------------------------- */
.uch-i {
  width: 16px; height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: -3px;
}
.uch-i-lg { width: 20px; height: 20px; }
.uch-i-xl { width: 28px; height: 28px; }

/* =====================================================================
   Login
   ===================================================================== */
.uch-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s5);
  background: var(--canvas);
}
.uch-auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s6);
}
.uch-auth-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r);
  background: var(--a);
  color: #fff;
  margin-bottom: var(--s4);
}
.uch-auth-card h1 { margin: 0 0 var(--s1); font-size: var(--t-title); font-weight: 600; letter-spacing: -.01em; }
.uch-auth-card p  { margin: 0 0 var(--s5); color: var(--ink-2); font-size: var(--t-meta); }

/* =====================================================================
   Shell
   ===================================================================== */
.uch-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: var(--s4);
  height: 52px;
  padding: 0 var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.uch-brand {
  display: flex; align-items: center; gap: var(--s2);
  font-weight: 600; font-size: 14px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
  white-space: nowrap; flex: none;
}
.uch-brand-mark {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 5px;
  background: var(--a); color: #fff;
}

.uch-nav { display: flex; gap: var(--s1); margin-left: var(--s4); }
.uch-nav a {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r);
  font-size: var(--t-body); font-weight: 500;
  color: var(--ink-2); text-decoration: none;
}
.uch-nav a:hover { background: var(--surface-2); color: var(--ink); }
.uch-nav a.uch-on { background: var(--a-soft); color: var(--a); font-weight: 600; }

.uch-spacer { flex: 1; }

.uch-user { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-meta); color: var(--ink-2); }
.uch-user b { color: var(--ink); font-weight: 600; }
.uch-avatar {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--a-soft); color: var(--a);
  font-size: 11px; font-weight: 700;
  flex: none;
}

.uch-page { max-width: 1360px; margin: 0 auto; padding: var(--s5); }

.uch-page-head { margin-bottom: var(--s5); }
.uch-page-head h1 { margin: 0 0 2px; font-size: var(--t-title); font-weight: 600; letter-spacing: -.01em; }
.uch-page-head p  { margin: 0; font-size: var(--t-meta); color: var(--ink-2); }

/* =====================================================================
   Cards
   ===================================================================== */
.uch-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--s5);
}
.uch-card-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.uch-card-head > * { max-width: 100%; }
.uch-card-head h2 { margin: 0; font-size: var(--t-body); font-weight: 600; }
.uch-card-body { padding: var(--s4); }

/* Stats — no coloured chrome; the number is the point --------------- */
.uch-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--s5);
  overflow: hidden;
}
.uch-stat { padding: var(--s4); border-left: 1px solid var(--line); }
.uch-stat:first-child { border-left: 0; }
.uch-stat-k {
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.uch-stat-v {
  font-size: 21px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.uch-stat-m { font-size: var(--t-meta); color: var(--ink-3); margin-top: 2px; }

/* =====================================================================
   Forms
   ===================================================================== */
.uch-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s3) var(--s4); }

.uch-legend {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
  margin-top: var(--s2);
}
.uch-legend:first-child { margin-top: 0; }

.uch-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.uch-f > label { font-size: var(--t-meta); font-weight: 500; color: var(--ink-2); }
.uch-f .uch-req { color: var(--neg); }

.uch-in, .uch-sel, .uch-ta {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  font: inherit;
  font-size: var(--t-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color .12s ease, box-shadow .12s ease;
  appearance: none;
}
.uch-sel {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2392928c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}
.uch-in:focus, .uch-sel:focus, .uch-ta:focus {
  outline: none;
  border-color: var(--a);
  box-shadow: 0 0 0 3px var(--a-soft);
}
.uch-in::placeholder, .uch-ta::placeholder { color: var(--ink-3); }
.uch-in[readonly] { background: var(--surface-2); color: var(--ink-2); border-style: dashed; }
.uch-ta { min-height: 58px; resize: vertical; }

.uch-num-in { text-align: right; font-variant-numeric: tabular-nums; }

.uch-inline { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.uch-inline > .uch-sel, .uch-inline > .uch-in,
.uch-inline > .uch-combo { flex: 1; min-width: 0; }

/* ------------------------------------------- searchable select (combobox) */
.uch-combo { position: relative; min-width: 0; }

/* The real <select> stays in the DOM as the value holder. */
.uch-combo-native {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.uch-combo-input { padding-right: 28px; cursor: text; }
.uch-combo-caret {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
  display: flex;
}

.uch-combo-pop {
  position: fixed;
  z-index: 95;
  overflow-y: auto;
  padding: var(--s1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .1);
  font-size: var(--t-body);
}
.uch-combo-opt {
  padding: 6px 9px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uch-combo-opt.uch-hl { background: var(--surface-2); }
.uch-combo-opt.uch-sel-on { color: var(--a); font-weight: 600; }
.uch-combo-opt.uch-sel-on.uch-hl { background: var(--a-soft); }
.uch-combo-none { padding: 8px 9px; color: var(--ink-3); }

/* Group headings inside a combobox list (e.g. Makkah / Madinah hotels) */
.uch-combo-group {
  padding: 6px 9px 3px;
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3);
}

/* Column spans */
.uch-c2{grid-column:span 2}.uch-c3{grid-column:span 3}.uch-c4{grid-column:span 4}.uch-c5{grid-column:span 5}
.uch-c6{grid-column:span 6}.uch-c8{grid-column:span 8}.uch-c12{grid-column:span 12}

/* The top bar never wraps: eight links and a name must stay on one 52px line. */
.uch-nav a, .uch-user span { white-space: nowrap; }
.uch-user > span:last-child { max-width: 220px; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
@media (max-width: 1280px) {
  .uch-nav a span { display: none; }
  .uch-nav a { padding: 6px 8px; }
}
@media (max-width: 1100px) {
  .uch-user > span:last-child { display: none; }
}

.uch-actions {
  display: flex; align-items: center; gap: var(--s2);
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}

/* =====================================================================
   Buttons — exactly one primary per view
   ===================================================================== */
.uch-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px;
  font: inherit; font-size: var(--t-body); font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.uch-btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.uch-btn:disabled { opacity: .5; cursor: not-allowed; }

.uch-btn-primary {
  color: #fff; background: var(--a); border-color: var(--a); font-weight: 600;
}
.uch-btn-primary:hover { background: var(--a-hover); border-color: var(--a-hover); }

.uch-btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.uch-btn-quiet:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }

.uch-btn-sm { padding: 4px 9px; font-size: var(--t-meta); }
.uch-btn-icon { padding: 6px; }
.uch-btn-full { width: 100%; }

/* =====================================================================
   Segmented control (module picker, ledger side switch)
   ===================================================================== */
.uch-seg {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  gap: 2px;
  /* Too many options for a narrow screen scroll inside the control rather
     than widening the page. */
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.uch-seg::-webkit-scrollbar { display: none; }
.uch-seg button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font: inherit; font-size: var(--t-meta); font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.uch-seg button:hover { color: var(--ink); }
.uch-seg button.uch-on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--line);
}
.uch-seg button.uch-on .uch-i { color: var(--a); }

/* =====================================================================
   Tables
   ===================================================================== */
.uch-tw { overflow-x: auto; }
.uch-t { width: 100%; border-collapse: collapse; }
.uch-t th {
  position: sticky; top: 0;
  text-align: left;
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s2) var(--s4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.uch-t td {
  padding: 9px var(--s4);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-body);
  white-space: nowrap;
  vertical-align: middle;
}
.uch-t tbody tr:last-child td { border-bottom: 0; }
.uch-t tbody tr:hover { background: var(--surface-2); }
.uch-t .uch-n { text-align: right; font-variant-numeric: tabular-nums; }
.uch-t .uch-strong { font-weight: 600; }
.uch-t tfoot td {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line-strong);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
}

/* Statement particulars may wrap rather than widen the drawer. */
.uch-drawer .uch-t td:nth-child(2) { white-space: normal; min-width: 200px; }

/* A cell that must not push the table wide */
.uch-clip {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uch-sub { display: block; font-size: var(--t-meta); color: var(--ink-3); }
.uch-dash { color: var(--ink-3); }

.uch-pos { color: var(--pos); }
.uch-neg { color: var(--neg); }

/* Row actions: one overflow menu, not a row of buttons -------------- */
.uch-menu { position: relative; }
.uch-menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px);
  z-index: 30;
  min-width: 150px;
  padding: var(--s1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .07);
}
.uch-menu-pop button {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%;
  padding: 6px 8px;
  font: inherit; font-size: var(--t-body);
  color: var(--ink);
  background: none; border: 0; border-radius: 4px;
  text-align: left; cursor: pointer;
}
.uch-menu-pop button:hover { background: var(--surface-2); }
.uch-menu-pop button.uch-danger { color: var(--neg); }
.uch-menu-pop button.uch-danger:hover { background: var(--neg-soft); }
.uch-menu-sep { height: 1px; background: var(--line); margin: var(--s1) 0; }

/* =====================================================================
   Status — one muted tint per state
   ===================================================================== */
.uch-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  font-size: var(--t-meta); font-weight: 500;
  border-radius: 999px;
  text-transform: capitalize;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.uch-badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: none;
}
.uch-badge-approved, .uch-badge-issued, .uch-badge-completed {
  background: var(--pos-soft); border-color: transparent; color: var(--pos);
}
.uch-badge-pending, .uch-badge-submitted {
  background: var(--warn-soft); border-color: transparent; color: var(--warn);
}
.uch-badge-rejected, .uch-badge-cancelled {
  background: var(--neg-soft); border-color: transparent; color: var(--neg);
}

/* =====================================================================
   Search field
   ===================================================================== */
.uch-search { position: relative; }
.uch-search .uch-i {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.uch-search .uch-in { padding-left: 30px; }

/* =====================================================================
   Alerts & toast
   ===================================================================== */
.uch-alert {
  display: none;
  align-items: flex-start; gap: var(--s2);
  padding: var(--s3);
  border-radius: var(--r);
  font-size: var(--t-body);
  margin-bottom: var(--s4);
}
.uch-alert.uch-show { display: flex; }
.uch-alert-error { background: var(--neg-soft); color: var(--neg); }
.uch-alert-ok    { background: var(--pos-soft); color: var(--pos); }

.uch-toast {
  position: fixed; left: 50%; bottom: var(--s5);
  transform: translate(-50%, 8px);
  z-index: 90;
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s4);
  border-radius: var(--r);
  background: var(--ink);
  color: #fff;
  font-size: var(--t-body);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.uch-toast.uch-show { opacity: 1; transform: translate(-50%, 0); }
.uch-toast-bad { background: var(--neg); }

/* =====================================================================
   Empty / loading / error states
   ===================================================================== */
.uch-state {
  display: none;
  flex-direction: column; align-items: center;
  gap: var(--s3);
  padding: var(--s7) var(--s5);
  text-align: center;
}
.uch-state.uch-show { display: flex; }
.uch-state .uch-i { color: var(--ink-3); }
.uch-state h3 { margin: 0; font-size: var(--t-body); font-weight: 600; }
.uch-state p  { margin: 0; max-width: 360px; font-size: var(--t-meta); color: var(--ink-2); }

.uch-skel {
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line) 25%, #f0f0ee 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: uch-sweep 1.3s ease-in-out infinite;
}
@keyframes uch-sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .uch-skel { animation: none; } }

/* =====================================================================
   Modal & drawer
   ===================================================================== */
.uch-scrim {
  position: fixed; inset: 0; z-index: 60;
  display: none;
  background: rgba(24, 24, 22, .32);
}
.uch-scrim.uch-show { display: block; }

/* A dialog never grows past the screen: the head and foot stay put and the
   body scrolls. The form inside passes the height down, or the body's
   overflow never takes effect and the bottom of a long dialog is cut off. */
.uch-modal {
  position: fixed; z-index: 70;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.uch-modal.uch-show { display: flex; }
.uch-modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.uch-modal-head, .uch-modal-foot { flex: none; }
.uch-modal .uch-modal-body { min-height: 0; overscroll-behavior: contain; }
@media (max-height: 560px), (max-width: 560px) {
  .uch-modal { top: 16px; transform: translateX(-50%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
}

.uch-drawer {
  position: fixed; z-index: 70;
  top: 0; right: 0; bottom: 0;
  width: min(760px, 100vw);
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.uch-drawer.uch-show { display: flex; }

.uch-modal-head, .uch-drawer-head {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s4);
  border-bottom: 1px solid var(--line);
}
.uch-modal-head h2, .uch-drawer-head h2 {
  margin: 0; font-size: var(--t-body); font-weight: 600;
}
.uch-modal-head p, .uch-drawer-head p {
  margin: 2px 0 0; font-size: var(--t-meta); color: var(--ink-2);
}
.uch-modal-body, .uch-drawer-body { padding: var(--s4); overflow-y: auto; flex: 1; }
.uch-modal-foot {
  display: flex; justify-content: flex-end; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* =====================================================================
   Statement summary strip
   ===================================================================== */
.uch-sum {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: var(--s4);
}
.uch-sum > div { padding: var(--s3); border-left: 1px solid var(--line); }
.uch-sum > div:first-child { border-left: 0; }
.uch-sum dt {
  margin: 0 0 3px;
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
}
.uch-sum dd {
  margin: 0;
  font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1000px) {
  .uch-c2, .uch-c3 { grid-column: span 4; }
  .uch-c4, .uch-c5 { grid-column: span 6; }
  .uch-nav a span { display: none; }
}
@media (max-width: 720px) {
  .uch-grid > * { grid-column: 1 / -1; }
  .uch-page { padding: var(--s4); }
  .uch-top { padding: 0 var(--s4); gap: var(--s2); }
  .uch-user b, .uch-user span { display: none; }
  /* Filters stack and fill the row instead of overflowing it. */
  .uch-card-head .uch-search,
  .uch-card-head .uch-search .uch-in { width: 100% !important; }
  .uch-card-head > .uch-sel { width: 100%; }
  /* Keep the logo mark, drop the wordmark — it has no room here. */
  .uch-brand { font-size: 0; gap: 0; }
  .uch-brand-mark { font-size: 14px; }
  .uch-stat { border-left: 0; border-top: 1px solid var(--line); }
  .uch-stat:first-child { border-top: 0; }
}

/* =====================================================================
   Chart
   ===================================================================== */
.uch-fig { margin: 0; position: relative; }
.uch-fig svg { display: block; overflow: visible; }

.uch-tip {
  position: absolute;
  left: 50%; top: 0;
  transform: translate(-50%, -4px);
  min-width: 150px;
  padding: var(--s2) var(--s3);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  font-size: var(--t-meta);
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s ease;
  z-index: 5;
}
.uch-tip.uch-show { opacity: 1; }
.uch-tip strong { display: block; margin-bottom: 4px; font-size: var(--t-body); }
.uch-tip div {
  display: flex; justify-content: space-between; gap: var(--s4);
  color: var(--ink-2);
}
.uch-tip div b { color: var(--ink); font-variant-numeric: tabular-nums; }
.uch-tip .uch-tip-meta {
  display: block;
  margin-top: 4px; padding-top: 4px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
}

/* Share-of-total bar inside a table cell — one hue, magnitude only. */
.uch-inbar {
  width: 72px; height: 6px;
  margin-left: auto;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.uch-inbar-fill { height: 100%; background: var(--a); border-radius: 3px; }

/* =====================================================================
   Export buttons
   ===================================================================== */
.uch-exports {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s3);
}
.uch-exports .uch-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--s3);
  text-align: left;
  font-weight: 600;
}
.uch-exports .uch-btn span {
  font-weight: 400;
  font-size: var(--t-meta);
  color: var(--ink-3);
}
.uch-exports .uch-btn .uch-i { color: var(--ink-3); margin-bottom: 2px; }

/* =====================================================================
   Repeatable sub-records (Umrah passengers, hotel legs)
   ===================================================================== */
.uch-subcard {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  padding: var(--s3);
  margin-bottom: var(--s3);
}
.uch-subcard:last-child { margin-bottom: 0; }

.uch-subcard-head {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s3);
}
.uch-subcard-head strong { font-size: var(--t-body); font-weight: 600; }
.uch-subcard-echo {
  font-size: var(--t-meta); color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.uch-subcard .uch-in, .uch-subcard .uch-sel { background: var(--surface); }

.uch-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--t-section); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.uch-chip-adl { background: var(--a-soft); border-color: transparent; color: var(--a); }
.uch-chip-chd { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.uch-chip-inf { background: #eef1f7; border-color: transparent; color: #3c5480; }

.uch-legtotal { font-variant-numeric: tabular-nums; font-size: var(--t-body); }

.uch-paxtotal {
  display: flex; flex-direction: column;
  padding: 7px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.uch-paxtotal .uch-sub { font-weight: 400; }

/* Passenger tick list on a hotel leg */
.uch-ticks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.uch-tick {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--t-body); color: var(--ink);
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}
.uch-tick:has(input:checked) {
  border-color: var(--a);
  background: var(--a-soft);
  color: var(--a);
  font-weight: 500;
}

/* Vendor split cards under the summary */
.uch-vendorsplit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s3);
  margin-top: var(--s3);
}
.uch-vendorcard {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s3);
  background: var(--surface);
}
.uch-vendorcard-name { font-weight: 600; }
.uch-vendorcard-svc { font-size: var(--t-meta); color: var(--ink-3); margin-bottom: 6px; }
.uch-vendorcard-amt {
  font-size: 16px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Letterhead — hidden on screen, shown on the printed statement. */
.uch-print-head { display: none; }

/* =====================================================================
   Print — statements and receipts
   ===================================================================== */
@media print {
  .uch-top, .uch-no-print, .uch-btn, .uch-scrim { display: none !important; }
  body.uch-body { background: #fff; }
  .uch-page { padding: 0; max-width: none; }
  .uch-card, .uch-drawer { border: 0; box-shadow: none; }

  /* Printing a statement prints only the statement, not the list behind it. */
  body.uch-has-drawer .uch-page { display: none !important; }

  .uch-drawer {
    position: static; width: auto; display: block !important;
    border-left: 0;
  }
  .uch-drawer-head { border-bottom: 0; padding: 0 0 var(--s2); }
  .uch-drawer-body { overflow: visible; padding: 0; }

  .uch-print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s4);
    padding-bottom: var(--s3);
    margin-bottom: var(--s4);
    border-bottom: 1.5px solid var(--ink);
  }
  .uch-print-head strong { display: block; font-size: 13px; }
  .uch-print-head span   { display: block; font-size: 10px; color: var(--ink-2); }
  .uch-print-meta { text-align: right; }

  .uch-sum { break-inside: avoid; }
  .uch-t th { position: static; }
  .uch-t td, .uch-t th { padding: 5px 8px; font-size: 11px; }
  .uch-t thead { display: table-header-group; }   /* repeat header per page */
  .uch-t tr { break-inside: avoid; }

  @page { margin: 14mm; }
  .uch-imp { display: none !important; }
}

/* =====================================================================
   v3 — branches, permissions, bank accounts, refunds, history
   ===================================================================== */

/* The whole date field opens the calendar, so it should look clickable. */
input[type="date"].uch-in { cursor: pointer; }
input[type="date"].uch-in::-webkit-calendar-picker-indicator { cursor: pointer; }

/* Working inside someone else's account — impossible to miss, never loud. */
.uch-imp {
  display: flex; align-items: center; gap: var(--s3);
  padding: 6px var(--s5);
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-meta);
}
.uch-imp strong { font-weight: 600; }
.uch-imp .uch-btn { color: var(--warn); border-color: currentColor; background: transparent; }

/* Who created / last changed a record */
.uch-who { font-size: var(--t-meta); color: var(--ink-3); margin: 0; }
.uch-who b { font-weight: 500; color: var(--ink-2); }

/* A second drawer (history) stacks above the first. */
.uch-drawer.uch-drawer-top { z-index: 76; width: min(620px, 100vw); }
.uch-modal.uch-modal-wide { width: min(760px, calc(100vw - 32px)); }

/* Activity history */
.uch-hist { list-style: none; margin: 0; padding: 0; }
.uch-hist > li {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.uch-hist > li:last-child { border-bottom: 0; }
.uch-hist-time { font-size: var(--t-meta); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.uch-hist-what { min-width: 0; }
.uch-hist-what strong { display: block; font-weight: 600; }
.uch-hist-by { font-size: var(--t-meta); color: var(--ink-2); }
.uch-hist-changes {
  margin-top: var(--s2);
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-meta);
}
.uch-hist-changes td { padding: 2px var(--s2) 2px 0; vertical-align: top; color: var(--ink-2); }
.uch-hist-changes td:first-child { color: var(--ink-3); white-space: nowrap; }
.uch-hist-changes s { color: var(--ink-3); }

/* Small neutral label: Shared, Refund, Reissue */
.uch-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-2);
  vertical-align: 1px;
}

.uch-badge-refunded { background: var(--surface-2); color: var(--ink-2); }
.uch-badge-reissued { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

/* Plain checkbox row, e.g. permissions and services */
.uch-check {
  display: flex; align-items: flex-start; gap: var(--s2);
  font-size: var(--t-body); color: var(--ink);
  font-weight: 400;
  cursor: pointer;
}
.uch-check input { margin-top: 3px; }

.uch-perms { display: flex; flex-direction: column; gap: var(--s4); }
.uch-perm-group h3 {
  margin: 0 0 var(--s2);
  font-size: var(--t-section); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.uch-perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--s4); }
@media (max-width: 720px) { .uch-perm-list { grid-template-columns: 1fr; } }

/* Computed figure in a form, e.g. refund due to the client */
.uch-calc {
  display: flex; flex-direction: column;
  padding: 7px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.uch-calc .uch-sub { font-weight: 400; }

/* Key facts about a record, in a dialog */
.uch-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin: 0 0 var(--s4);
  overflow: hidden;
}
.uch-facts > div { padding: var(--s2) var(--s3); border-left: 1px solid var(--line); }
.uch-facts > div:first-child { border-left: 0; }
.uch-facts dt { font-size: var(--t-section); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.uch-facts dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Ticket lifecycle */
.uch-life { list-style: none; margin: 0; padding: 0; }
.uch-life > li {
  position: relative;
  padding: 0 0 var(--s4) var(--s5);
  border-left: 1px solid var(--line-strong);
  margin-left: 6px;
}
.uch-life > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.uch-life > li::before {
  content: ""; position: absolute; left: -5px; top: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--ink-3);
}
.uch-life > li.uch-life-now::before { border-color: var(--a); background: var(--a); }
.uch-life h4 { margin: 0; font-size: var(--t-body); font-weight: 600; }
.uch-life p { margin: 2px 0 0; font-size: var(--t-meta); color: var(--ink-2); }

/* Umrah service picker */
.uch-services { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); }
.uch-services .uch-tick { padding: 6px 12px; }
.uch-card[data-off="1"] .uch-card-body,
.uch-card[data-off="1"] .uch-card-head > :not(h2):not(.uch-svc-state) { display: none; }
.uch-card[data-off="1"] { background: var(--surface-2); }
.uch-svc-state { font-size: var(--t-meta); color: var(--ink-3); }

.uch-mono { font-family: var(--mono); font-size: var(--t-meta); }

/* =====================================================================
   v4 — ticket passengers, expenses, bill reminders
   ===================================================================== */

/* Passenger rows on a ticket booking */
.uch-pax { display: flex; flex-direction: column; gap: var(--s2); }
.uch-pax-row, .uch-pax-headrow {
  display: grid;
  grid-template-columns: 22px minmax(150px, 2fr) 96px minmax(90px, 1fr) minmax(90px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) 32px;
  gap: var(--s2);
  align-items: center;
}
.uch-pax-headrow { font-size: var(--t-meta); font-weight: 500; color: var(--ink-2); }
.uch-pax-n { font-size: var(--t-meta); color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.uch-pax-row[data-locked="1"] .uch-pax-lock { display: block; }
.uch-pax-lock { display: none; grid-column: 2 / -1; font-size: var(--t-meta); color: var(--ink-3); margin-top: -4px; }
.uch-pax-foot { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.uch-pax-foot .uch-who { margin-left: auto; }
@media (max-width: 900px) {
  .uch-pax-headrow { display: none; }
  .uch-pax-row { grid-template-columns: 22px 1fr 1fr 32px; padding-bottom: var(--s2); border-bottom: 1px solid var(--line); }
  .uch-pax-row > .uch-pax-name { grid-column: 2 / 4; }
  .uch-pax-row > :not(.uch-pax-n):not(.uch-pax-name):not(.uch-pax-del):not(.uch-pax-lock) { grid-column: span 1; }
}

/* Bill reminders — a small card under the top bar, never a blocking dialog */
.uch-remind {
  position: fixed; z-index: 55;
  right: var(--s4); top: 64px;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--warn);
  border-radius: var(--r);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  font-size: var(--t-body);
}
.uch-remind-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.uch-remind-head strong { font-weight: 600; }
.uch-remind-head .uch-i { color: var(--warn); }
.uch-remind ul { list-style: none; margin: 0; padding: var(--s2) var(--s3); max-height: 40vh; overflow-y: auto; }
.uch-remind li { padding: 4px 0; }
.uch-remind li + li { border-top: 1px solid var(--line); }
.uch-remind li .uch-sub { margin-top: 1px; }
.uch-remind li.uch-over b { color: var(--neg); }
.uch-remind-foot { padding: var(--s2) var(--s3); border-top: 1px solid var(--line); display: flex; gap: var(--s2); justify-content: flex-end; }

/* Expense status badges */
.uch-badge-paid { background: var(--pos-soft); border-color: transparent; color: var(--pos); }
.uch-badge-unpaid { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.uch-badge-overdue { background: var(--neg-soft); border-color: transparent; color: var(--neg); }

/* Recurring bill list */
.uch-bills { list-style: none; margin: 0; padding: 0; }
.uch-bills li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--s3); align-items: center;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.uch-bills li:last-child { border-bottom: 0; }
.uch-bills .uch-strong { display: block; }
@media (max-width: 720px) { .uch-bills li { grid-template-columns: 1fr; } }
