/* NALQIVO ERP — Daily Treasury Reconciliation & Closing | إقفال ومطابقة الخزينة اليومية
   Ten screens on the shared tokens: white cards, one violet accent, soft tints,
   tabular figures. No new palette and no new interaction language. */

.tcl-app { display: block; }
.tcl-app .page-actions { flex-wrap: wrap; }
.tcl-app .ltr { direction: ltr; unicode-bidi: embed; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tcl-app .strong { font-weight: 700; color: var(--ink); }

/* ---- Screen switcher ---------------------------------------------------- */
.tcl-subnav {
  display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto;
  padding: 4px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff;
  scrollbar-width: thin;
}
.tcl-subnav::-webkit-scrollbar { height: 5px; }
.tcl-subnav::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
.tcl-subtab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 9px;
  color: var(--muted); font-size: 12px; font-weight: 600;
  white-space: nowrap; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.tcl-subtab svg { opacity: .8; flex: 0 0 auto; }
.tcl-subtab:hover { background: var(--surface-2); color: var(--ink-2); }
.tcl-subtab.active { background: var(--brand-50); color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-100); }
.tcl-subtab.active svg { opacity: 1; color: var(--brand); }

/* ---- Toolbar ------------------------------------------------------------ */
.tcl-toolbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.tcl-toolbar-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- KPIs --------------------------------------------------------------- */
.tcl-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.tcl-kpi {
  /* kpi card lock */
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-width: 0;
  padding: 13px 15px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff;
}
.tcl-kpi::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 3px; background: transparent;
}
.tcl-kpi.good::before { background: var(--green); }
.tcl-kpi.warn::before { background: var(--amber); }
.tcl-kpi.good { background: linear-gradient(135deg, #fff 40%, var(--green-soft) 180%); }
.tcl-kpi.warn { background: linear-gradient(135deg, #fff 40%, var(--amber-soft) 180%); }
.tcl-kpi-label { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.tcl-kpi-value { font-size: 19px; font-weight: 750; color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
.tcl-kpi-value.ltr { display: block; width: 100%; text-align: start; direction: ltr; unicode-bidi: isolate; }
.tcl-kpi-hint { font-size: 10px; color: var(--muted-2); line-height: 1.5; }

/* ---- Layout ------------------------------------------------------------- */
.tcl-grid {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 16px; align-items: start; margin-bottom: 16px;
}
.tcl-grid > .tcl-stack { display: flex; flex-direction: column; gap: 16px; }
.tcl-stack { display: flex; flex-direction: column; gap: 16px; }
.tcl-card { min-width: 0; margin: 0; }
.tcl-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 15px 18px 10px;
}
.tcl-card-head h3 { margin: 0; font-size: 14.5px; color: var(--ink); }
.tcl-card-head p { margin: 3px 0 0; line-height: 1.6; }
.tcl-count {
  display: inline-grid; place-items: center; min-width: 28px; height: 24px;
  padding: 0 8px; border-radius: 99px; background: var(--surface-3);
  color: var(--muted); font-size: 11px; font-weight: 700; flex: 0 0 auto;
}

/* ---- Tables ------------------------------------------------------------- */
.tcl-table-wrap { overflow-x: auto; }
.tcl-table { margin: 0; width: 100%; }
.tcl-table th { white-space: nowrap; font-size: 10.5px; font-weight: 600; }
.tcl-table td { vertical-align: middle; }
.tcl-table.compact th, .tcl-table.compact td { padding: 6px 9px; font-size: 10.5px; }
.tcl-table tfoot th { font-size: 11px; color: var(--ink-2); background: var(--surface-2); }
.tcl-table tbody tr:last-child td { border-bottom: 0; }
.tcl-row-actions { display: flex; gap: 2px; justify-content: flex-end; white-space: nowrap; }
.tcl-row-warn { background: var(--red-soft); }

/* ---- Confirmation status list ------------------------------------------ */
.tcl-status-list { display: flex; flex-direction: column; padding: 0 6px 10px; }
.tcl-status-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
}
.tcl-status-row + .tcl-status-row { border-top: 1px solid var(--line); border-radius: 0; }
.tcl-status-name { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.tcl-status-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* ---- Alerts ------------------------------------------------------------- */
.tcl-alert-list { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 14px; }
.tcl-alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
}
.tcl-alert.danger { border-color: #f0c8cd; background: var(--red-soft); }
.tcl-alert-ico { color: var(--amber); display: inline-flex; padding-top: 1px; flex: 0 0 auto; }
.tcl-alert.danger .tcl-alert-ico { color: var(--red); }
.tcl-alert-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tcl-alert-copy b { font-size: 11.5px; font-weight: 650; color: var(--ink-2); line-height: 1.55; }
.tcl-alert-copy span { font-size: 10px; color: var(--muted-2); }
.tcl-inline-alert {
  display: flex; align-items: center; gap: 8px;
  margin: 0 18px 12px; padding: 9px 12px;
  border: 1px solid #f0c8cd; border-radius: 9px;
  background: var(--red-soft); color: #b32e3d; font-size: 11.5px; font-weight: 600;
}

/* ---- Empty state -------------------------------------------------------- */
.tcl-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 34px 18px; color: var(--muted); text-align: center;
}
.tcl-empty svg { color: var(--brand-300); }
.tcl-empty span { font-size: 11.5px; line-height: 1.7; max-width: 360px; }

/* ---- Empty-day / start screens ----------------------------------------- */
.tcl-intro { padding: 22px; }
.tcl-intro-icon {
  display: inline-grid; place-items: center; width: 48px; height: 48px;
  border-radius: 14px; background: var(--brand-50); color: var(--brand);
  margin-bottom: 12px;
}
.tcl-intro h2 { margin: 0 0 6px; font-size: 19px; color: var(--ink); letter-spacing: -.01em; }
.tcl-intro > p { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.8; max-width: 620px; }
.tcl-start { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tcl-note {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 10.5px; line-height: 1.7;
}
.tcl-note svg { flex: 0 0 auto; color: var(--brand-300); margin-top: 1px; }
.tcl-card > .tcl-note { margin: 0 18px 14px; }
.tcl-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; margin: 3px 18px 14px; }
.tcl-dl dt { font-size: 10.5px; color: var(--muted); }
.tcl-dl dd { margin: 0; font-size: 11.5px; color: var(--ink-2); text-align: end; }
.tcl-today { padding: 4px 18px 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tcl-today-no { font-size: 18px; font-weight: 750; color: var(--ink); letter-spacing: .01em; }
.tcl-today .tcl-dl { margin: 0; width: 100%; }
.tcl-mini-kpis {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  margin: 0 18px 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--line);
}
.tcl-mini-kpis > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 11px; background: #fff; }
.tcl-mini-kpis span { font-size: 9.5px; color: var(--muted); }
.tcl-mini-kpis b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Filters & pager ---------------------------------------------------- */
.tcl-filters {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 0 18px 12px;
}
.tcl-pager {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 18px 16px;
}

/* ---- Forms -------------------------------------------------------------- */
.tcl-field { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.tcl-field.grow { flex: 1; min-width: 200px; }
.tcl-field > span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.tcl-field input, .tcl-field select, .tcl-field textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--ink);
  font: inherit; font-size: 12px;
}
.tcl-field textarea { resize: vertical; min-height: 54px; }
.tcl-field input:focus, .tcl-field select:focus, .tcl-field textarea:focus {
  outline: none; border-color: var(--brand-300);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.tcl-form { display: flex; flex-direction: column; gap: 11px; padding: 0 18px 18px; }
.tcl-form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.tcl-form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tcl-card-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 0 18px 16px; }
.tcl-inline-form {
  display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
  padding: 0 18px 12px;
}
.tcl-inline-input {
  width: 100%; max-width: 220px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font: inherit; font-size: 11px; color: var(--ink);
}
.tcl-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11.5px; color: var(--ink-2); line-height: 1.6; cursor: pointer;
}
.tcl-check input { margin-top: 2px; flex: 0 0 auto; }

/* ---- Frozen banner ------------------------------------------------------ */
.tcl-frozen {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px;
  border: 1px solid var(--brand-200); border-radius: 12px;
  background: linear-gradient(135deg, #fff 20%, var(--brand-50) 150%);
}
.tcl-frozen svg { color: var(--brand); flex: 0 0 auto; }
.tcl-frozen div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tcl-frozen b { font-size: 12px; color: var(--ink); }
.tcl-frozen .small { font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.tcl-hash {
  padding: 3px 8px; border-radius: 6px; background: #fff;
  border: 1px solid var(--brand-100); color: var(--brand-2);
  font-size: 10px; font-weight: 600;
}

/* ---- Cash counting ------------------------------------------------------ */
.tcl-count-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px; padding: 0 18px 18px;
}
.tcl-count-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.tcl-count-card.ok { border-color: var(--brand-100); background: linear-gradient(160deg, #fff 60%, var(--green-soft) 170%); }
.tcl-count-card.exception { border-color: #f0c8cd; background: linear-gradient(160deg, #fff 60%, var(--red-soft) 180%); }
.tcl-count-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tcl-count-metrics {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.tcl-count-metrics > div { display: flex; flex-direction: column; gap: 2px; }
.tcl-count-metrics span { font-size: 9.5px; color: var(--muted); }
.tcl-count-metrics b { font-size: 12px; color: var(--ink); }
.tcl-count-meta { font-size: 10px; color: var(--muted); line-height: 1.7; }
.tcl-count-card .btn { align-self: flex-start; }
.tcl-denom-details { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.tcl-denom-details summary {
  padding: 7px 10px; cursor: pointer; list-style: none;
  font-size: 10.5px; font-weight: 600; color: var(--ink-2);
}
.tcl-denom-details summary::-webkit-details-marker { display: none; }
.tcl-denom-details summary::before { content: "+"; display: inline-block; width: 14px; color: var(--brand); font-weight: 700; }
.tcl-denom-details[open] summary::before { content: "−"; }
.tcl-denom-details .table { margin: 0; background: #fff; }

/* ---- Count modal -------------------------------------------------------- */
.tcl-modal-form { padding: 0; gap: 12px; }
.tcl-modal-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.tcl-modal-summary > div { display: flex; flex-direction: column; gap: 2px; }
.tcl-modal-summary span { font-size: 9.5px; color: var(--muted); }
.tcl-modal-summary b { font-size: 12px; color: var(--ink); }
.tcl-denom-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.tcl-denom-head {
  padding: 7px 10px; background: var(--surface-2);
  font-size: 9.5px; font-weight: 700; color: var(--muted);
}
.tcl-denom-value, .tcl-denom-line { padding: 7px 10px; background: #fff; font-size: 11.5px; color: var(--ink-2); }
.tcl-denom-line { display: flex; align-items: center; color: var(--muted); }
.tcl-num {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; font: inherit; font-size: 11.5px; text-align: end;
}
.tcl-num:focus { outline: none; border-color: var(--brand-300); box-shadow: 0 0 0 2px var(--brand-50); }
.tcl-nonstd { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 9px 11px; background: var(--surface-2); }
.tcl-nonstd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tcl-nonstd-head b { font-size: 10.5px; color: var(--ink-2); }
.tcl-nonstd-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 6px; margin-top: 5px; }
.tcl-nonstd-row input {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font: inherit; font-size: 11px;
}
.tcl-nonstd-row input:focus { outline: none; border-color: var(--brand-300); }
.tcl-count-total {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 13px; border-radius: 10px;
  background: var(--brand-50); border: 1px solid var(--brand-100);
}
.tcl-count-total > span:first-child { font-size: 11px; color: var(--brand-2); font-weight: 600; }
.tcl-count-total b { font-size: 17px; color: var(--brand-2); }
.tcl-diff { margin-inline-start: auto; font-size: 10.5px; color: var(--muted); }
.tcl-diff b { font-size: 13px; }

/* ---- Bank / exchange / FX ---------------------------------------------- */
.tcl-callout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 0 18px 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.tcl-callout > div { display: flex; flex-direction: column; gap: 3px; }
.tcl-callout span { font-size: 9.5px; color: var(--muted); }
.tcl-callout b { font-size: 12.5px; color: var(--ink); }

/* ---- Approval ----------------------------------------------------------- */
.tcl-decision-card { border-color: var(--brand-200); }
.tcl-decision-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 0 18px 18px;
}
.tcl-decision-actions .btn { flex: 1; min-width: 150px; justify-content: center; }

/* ---- Report ------------------------------------------------------------- */
.tcl-report-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 14px; }
.tcl-report-hash {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 0 18px 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.tcl-report-hash > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.tcl-report-hash span { font-size: 9.5px; color: var(--muted); }
.tcl-report-hash b { font-size: 11.5px; color: var(--ink-2); overflow-wrap: anywhere; max-width: 100%; }
.tcl-report-hash b.small { font-size: 9.5px; color: var(--muted); }
.tcl-attach-list { display: flex; flex-direction: column; gap: 6px; padding: 0 18px 16px; }
.tcl-attach-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.tcl-attach-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand-50); color: var(--brand); flex: 0 0 auto; }
.tcl-attach-row > div { flex: 1; min-width: 0; }
.tcl-attach-row > div > div:first-child { font-size: 11.5px; color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Correction form ---------------------------------------------------- */
.tcl-correction-form { border: 1px solid var(--line); border-radius: 10px; margin: 0 18px 16px; }
.tcl-correction-form > summary {
  padding: 10px 12px; cursor: pointer; list-style: none;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.tcl-correction-form > summary::-webkit-details-marker { display: none; }
.tcl-correction-form > summary::before { content: "+"; display: inline-block; width: 16px; color: var(--brand); font-weight: 700; }
.tcl-correction-form[open] > summary::before { content: "−"; }
.tcl-correction-form .tcl-form { padding: 0 12px 12px; }
.tcl-correction-form .tcl-note { margin: 0 12px 12px; }

/* ---- Verify modal ------------------------------------------------------- */
.tcl-verify { display: flex; flex-direction: column; gap: 9px; }
.tcl-verify-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.tcl-verify-row.ok { border-color: #cce9df; background: var(--green-soft); }
.tcl-verify-row.bad { border-color: #f0c8cd; background: var(--red-soft); }
.tcl-verify-row > svg { flex: 0 0 auto; margin-top: 1px; }
.tcl-verify-row.ok > svg { color: var(--green); }
.tcl-verify-row.bad > svg { color: var(--red); }
.tcl-verify-row b { font-size: 11.5px; color: var(--ink); }
.tcl-verify-row .small { font-size: 9.5px; overflow-wrap: anywhere; margin-top: 2px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1080px) {
  .tcl-grid { grid-template-columns: minmax(0, 1fr); }
  .tcl-grid > .tcl-stack { order: 2; }
}
@media (max-width: 720px) {
  .tcl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tcl-kpi-value { font-size: 16px; }
  .tcl-form-2 { grid-template-columns: 1fr; }
  .tcl-modal-summary { grid-template-columns: 1fr; }
  .tcl-denom-grid { grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr); }
  .tcl-count-grid { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .tcl-report-hash { grid-template-columns: 1fr; }
  .tcl-card-head { padding: 13px 14px 8px; }
  .tcl-toolbar { align-items: stretch; }
  .tcl-mini-kpis { grid-template-columns: 1fr; }
  .tcl-today { padding: 2px 14px 14px; }
  .tcl-dl { margin: 3px 14px 12px; }
  .tcl-frozen { align-items: flex-start; }
  .tcl-hash { display: none; }
  .tcl-decision-actions .btn { min-width: 100%; }
  .tcl-alert-list { padding: 0 12px 12px; }
  .tcl-inline-alert { margin: 0 14px 12px; }
  .tcl-report-actions { padding: 0 14px 12px; }
  .tcl-report-hash { margin: 0 14px 12px; }
  .tcl-attach-list { padding: 0 14px 14px; }
  .tcl-filters { padding: 0 14px 10px; }
  .tcl-form { padding: 0 14px 14px; }
  .tcl-correction-form { margin: 0 14px 14px; }
}

@media print {
  .tcl-subnav, .page-actions, .tcl-toolbar, .tcl-frozen .tcl-hash { display: none !important; }
  .tcl-card { break-inside: avoid; }
}

/* Bank evidence columns stay separate in RTL and scroll on smaller screens. */
.tcl-bank-table { min-width: 980px; }
.tcl-bank-table th, .tcl-bank-table td { padding: 12px 14px; }
.tcl-bank-table td:first-child { min-width: 200px; max-width: 300px; white-space: normal; overflow-wrap: anywhere; }
.tcl-bank-table td:nth-child(7) { min-width: 190px; }
