/* =========================================================================
   WorkFlow · custom theme over Bootstrap 5
   Matches the original EliteAdmin-style theme:
   white nav header, dark grey topbar, black/orange brand, teal table headers
   ========================================================================= */

:root {
  --topbar-bg:    #374151;
  --topbar-fg:    #FFFFFF;
  --brand-orange: #f58442;
  --brand-red:    #c41313;
  --brand-dark:   #4a4944;
  --table-head:   #0f597a;
  --sidebar-bg:   #f4f5f9;
  --sidebar-fg:   #181c32;
  --sidebar-hover:#e3e7ee;
  --sidebar-active:#374151;
  --page-bg:      #f4f5f9;
  --card-bg:      #FFFFFF;
  --text:         #181c32;
  --muted:        #6c757d;
  --line:         #e6eaf0;
  --sidew:        65px;
  --sidew-open:   240px;
  --topbar-h:     58px;
  --accent-teal:  #20c997;
  --accent-blue:  #374151;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--page-bg);
}

.text-orange { color: var(--brand-orange) !important; }
.bg-orange   { background: var(--brand-orange) !important; }
.text-dark   { color: var(--text) !important; }

#main-wrapper { min-height: 100vh; padding-top: var(--topbar-h); }
.page-wrapper { margin-left: var(--sidew); }
@media (max-width: 800px) { .page-wrapper { margin-left: 0; } }

/* ============= TOPBAR (teal, matches SR brand) ============= */
.topbar {
  background: var(--topbar-bg);
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 1030;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.topbar .navbar { padding: 0; height: var(--topbar-h); display: flex; align-items: center; padding: 0 18px; }
.topbar .navbar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #fff;
  font-size: 22px; font-weight: 700;
  letter-spacing: -.5px;
}
.topbar .logo-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: rgba(255,255,255,.18); color: #fff;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
}
.topbar .logo-text { font-size: 22px; color: #fff; }
.topbar .logo-text strong { font-weight: 800; color: #fff; }

.topbar-tools { color: #fff; }
.topbar-tools .topbar-icon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  color: rgba(255,255,255,.92);
  text-decoration: none;
  font-size: 18px;
}
.topbar-tools .topbar-icon:hover { background: rgba(255,255,255,.18); color: #fff; }
.topbar-tools .topbar-icon .badge {
  position: absolute; top: 2px; right: 2px;
  font-size: 10px; padding: 2px 5px;
  min-width: 16px; border-radius: 8px;
}
.topbar-tools .input-group-text { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.topbar-tools .form-control { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.topbar-tools .form-control::placeholder { color: rgba(255,255,255,.75); }
.topbar-tools .form-control:focus { background: rgba(255,255,255,.95); color: var(--text); }

.user-pill {
  display: inline-flex; align-items: center;
  text-decoration: none; color: #fff;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: transparent;   /* no frame around the user — avatar + name only */
  border: 0;
  font-size: 13px;
}
.user-pill:hover { background: rgba(255,255,255,.12); color: #fff; }
.user-pill::after { display: none; }
.user-pill .avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-dark); color: #fff;
  font-weight: 700; font-size: 13px;
}

/* ============= SIDEBAR (mini, icon-only, hover-expand) ============= */
.sidebar {
  background: var(--sidebar-bg);
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidew);
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--line);
  z-index: 1020;
  transition: width .2s ease;
}
.sidebar:hover { width: var(--sidew-open); box-shadow: 4px 0 14px rgba(0,0,0,.08); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #c8cfd9; border-radius: 3px; }

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-section {
  padding: 14px 14px 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 700;
  white-space: nowrap; overflow: hidden;
  opacity: 0;
  transition: opacity .15s;
}
.sidebar:hover .sidebar-section { opacity: 1; }
.sidebar-item { padding: 0; }
.sidebar-link {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
  color: var(--sidebar-fg);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background .12s ease;
  position: relative;
  white-space: nowrap;
}
.sidebar-link i { font-size: 20px; color: var(--muted); width: 20px; text-align: center; flex: 0 0 20px; }
.sidebar-link .hide-menu { opacity: 0; transition: opacity .15s; pointer-events: none; }
.sidebar:hover .sidebar-link .hide-menu { opacity: 1; pointer-events: auto; }
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--text); text-decoration: none; }
.sidebar-link.active {
  background: #fff;
  color: var(--sidebar-active);
  font-weight: 600;
  border-left-color: var(--sidebar-active);
}
.sidebar-link.active i { color: var(--sidebar-active); }
.sidebar-link.has-arrow::after {
  content: "\F0142";
  font-family: "Material Design Icons";
  margin-left: auto;
  font-size: 16px;
  color: var(--muted);
  transition: transform .15s, opacity .15s;
  opacity: 0;
}
.sidebar:hover .sidebar-link.has-arrow::after { opacity: 1; }
.sidebar-link.has-arrow[aria-expanded="true"]::after { transform: rotate(90deg); }
.sidebar-link.sub { padding-left: 55px; font-size: 12.8px; }
.sidebar-link.sub i { font-size: 16px; }

.first-level { background: #e8edf4; max-height: 0; overflow: hidden; }
.first-level.show { max-height: none; }
/* Tooltip when collapsed */
.sidebar:not(:hover) .sidebar-link[title]:hover::before {
  content: attr(title);
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: #333; color: #fff;
  padding: 6px 12px; border-radius: 4px;
  font-size: 12px; white-space: nowrap;
  z-index: 2000;
}

/* ============= PAGE LAYOUT ============= */
.page-wrapper { background: var(--page-bg); min-height: calc(100vh - var(--topbar-h)); }

/* Breadcrumb card (matches the WorkFlow original) */
.page-breadcrumb {
  background: var(--card-bg);
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.page-title {
  font-size: 17px; font-weight: 600; color: var(--text);
  margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.page-title .more {
  color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 0 8px;
}
.breadcrumb { font-size: 12.5px; margin: 0; }
.breadcrumb a { color: var(--accent-blue); text-decoration: none; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); content: "›"; }
.breadcrumb-item.active { color: var(--muted); font-weight: 500; }

.page-content { padding: 18px 24px 60px; }

/* ============= CARDS ============= */
.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.03); margin-bottom: 18px; }
.card-header { background: var(--card-bg); border-bottom: 1px solid var(--line); padding: 12px 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header i { color: var(--brand-red); }
.card-body { padding: 16px 18px; }
.card-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--brand-red); }

/* ============= TABLES ============= */
.table {
  font-size: 13px;
  margin-bottom: 0;
}
.table thead th {
  background: #374151;
  color: #fff;
  border-bottom: none;
  padding: 9px 12px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 600;
}
.table td { padding: 9px 12px; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-striped tbody tr:nth-of-type(odd) { background: #fbfcfd; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: #e8f2fa; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.tight { font-variant-numeric: tabular-nums; }

/* ============= STATUS PILLS ============= */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.pill.pending  { background: #FEF3C7; color: #B45309; }
.pill.approved { background: #DCFCE7; color: #15803D; }
.pill.rejected { background: #FEE2E2; color: #B91C1C; }
.pill.muted    { background: #e2e8f0; color: #475569; }
.pill.waiting  { background: #DBEAFE; color: #1E40AF; text-transform: none; letter-spacing: 0; font-weight: 600; }
.pill.waiting i.mdi { font-size: 13px; vertical-align: -1px; margin-right: 3px; }

/* "Signature On" list-page cell. Two stacked lines: a small muted label with
   a status icon, and the role name beneath it in a slightly bolder colour.
   Tint shifts by state — blue for waiting, green for approved, red for rejected. */
.sig-on            { line-height: 1.35; }
.sig-on-label      { font-size: 11px; color: #6B7280; font-weight: 500; letter-spacing: .1px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 4px; }
.sig-on-label .mdi { font-size: 13px; color: #2563EB; }
.sig-on-role       { font-size: 13px; color: #1E3A8A; font-weight: 600; margin-top: 2px; }
.sig-on.approved .sig-on-label .mdi { color: #15803D; }
.sig-on.approved .sig-on-role       { color: #14532D; }
.sig-on.rejected .sig-on-label .mdi { color: #B91C1C; }
.sig-on.rejected .sig-on-role       { color: #7F1D1D; }
.sig-on-date       { color: #94A3B8; font-weight: 400; }
.sig-on-empty      { color: #C0C6CC; font-size: 14px; }

.tag {
  display: inline-block; padding: 2px 8px;
  background: #e2e8f0; color: #334155;
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  border-radius: 3px;
}
.tag.brand { background: #DBEAFE; color: #1e40af; }

/* ============= KPI TILES ============= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand-red); opacity: .8;
}
.kpi.warn::before { background: var(--brand-orange); }
.kpi.good::before { background: #15803D; }
.kpi.info::before { background: var(--table-head); }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; font-weight: 600; }

/* ============= FORMS ============= */
.form-label, .control-label {
  font-size: 12px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  text-transform: none;
}
.form-label .req, .control-label .req { color: var(--brand-red); }
.form-control, .form-select {
  font-size: 13.5px;
  border: 1px solid #d6dde6;
  border-radius: 4px;
  padding: 7px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--sidebar-active);
  box-shadow: 0 0 0 .2rem rgba(55,65,81,.15);
}
textarea.form-control { line-height: 1.5; min-height: 80px; }

/* Items input table */
.items-input { width: 100%; border-collapse: collapse; }
.items-input thead th { background: #374151; color: #fff; padding: 8px 10px; font-size: 11px; text-transform: uppercase; }
.items-input td { padding: 5px; vertical-align: top; border-bottom: 1px solid var(--line); }
.items-input input, .items-input select, .items-input textarea {
  width: 100%; padding: 6px 9px; border: 1px solid #d6dde6; border-radius: 4px; font-size: 13px; font-family: inherit;
}
.items-input .del-row {
  background: transparent; border: none; color: var(--brand-red); font-size: 18px;
  cursor: pointer; padding: 4px 8px;
}

/* ============= BUTTONS ============= */
.btn { font-size: 13px; padding: 6px 14px; border-radius: 4px; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-primary { background: var(--table-head); border-color: var(--table-head); }
.btn-primary:hover { background: #0a4760; border-color: #0a4760; }
.btn-cta {
  background: transparent; border-color: #374151; color: #374151;
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 10px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-cta:hover { background: #374151; border-color: #374151; color: #fff; }
.btn-cta i { font-size: 17px; }
.btn-export {
  background: #fff; color: var(--text); border: 1px solid var(--line-2);
  font-weight: 600; padding: 6px 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-export:hover { background: var(--sidebar-bg); }
.btn-success { background: #15803D; border-color: #15803D; }
.btn-success:hover { background: #14532D; border-color: #14532D; }
.btn-warning { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }
.btn-warning:hover { background: #e07330; color: #fff; }
.btn-danger  { background: var(--brand-red); border-color: var(--brand-red); }

/* ============= FLOATING ACTION BUTTON ============= */
.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-blue); color: #fff;
  display: grid; place-items: center;
  font-size: 22px;
  box-shadow: 0 6px 18px rgba(41,161,215,.4);
  text-decoration: none;
  z-index: 1010;
  transition: transform .12s;
}
.fab:hover { background: #1f87b5; color: #fff; transform: scale(1.05); text-decoration: none; }

/* ============= RIGHT SIDE TOOLBAR (Mobile Form / Next Form / Total) ============= */
.side-tabs {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1px;
  z-index: 1005;
}
.side-tabs a {
  writing-mode: vertical-rl;
  background: #4a4944; color: #fff;
  padding: 14px 8px; font-size: 11px; font-weight: 600;
  text-decoration: none; letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 4px 0 0 4px;
}
.side-tabs a:hover { background: #2f2c2a; color: #fff; }
.side-tabs a.total { background: #c41313; }

/* ============= ALERTS / FLASH ============= */
.flash { padding: 10px 14px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.flash.ok   { background: #DCFCE7; color: #15803D; border-left: 4px solid #15803D; }
.flash.err  { background: #FEE2E2; color: #B91C1C; border-left: 4px solid #B91C1C; }
.flash.info { background: #DBEAFE; color: #1e40af; border-left: 4px solid #1e40af; }
.flash.warn { background: #FEF3C7; color: #B45309; border-left: 4px solid #B45309; }

/* ============= DETAIL/KV ============= */
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 38%; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; padding-right: 12px; }
.kv tr:last-child td { border-bottom: none; }

.big-amount { font-size: 30px; font-weight: 700; color: var(--table-head); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.big-amount .ccy { font-size: 14px; color: var(--muted); margin-left: 6px; font-weight: 500; }

/* ============= APPROVAL / REJECTION STAMPS ============= */
.stamp {
  display: inline-block;
  padding: 6px 16px;
  border: 4px double currentColor;
  border-radius: 6px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 18px;
  font-family: "Arial Black", Arial, sans-serif;
  transform: rotate(-3deg);
  opacity: .85;
  position: relative;
  user-select: none;
  background: rgba(255,255,255,.85);
}
.stamp::before {
  content: "";
  position: absolute; left: -3px; top: -3px; right: -3px; bottom: -3px;
  border: 1px solid currentColor;
  border-radius: 8px;
  pointer-events: none;
}
.stamp.approved { color: #15803D; }
.stamp.approved::after {
  content: "✓ ";
  font-weight: 900;
}
.stamp.rejected { color: #B91C1C; transform: rotate(3deg); }
.stamp.rejected::after {
  content: " ✕";
}
.stamp.pending { color: #B45309; transform: rotate(-1deg); opacity: .65; }

/* ============= COMMENTS ============= */
.comments-list { list-style: none; padding: 0; margin: 0; }
.comments-list li {
  display: flex; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.comments-list li:last-child { border-bottom: none; }
.comments-list .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-dark); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex: 0 0 36px;
}
.comments-list .meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.comments-list .name { font-weight: 700; color: var(--text); }
.comments-list .when { font-size: 11.5px; color: var(--muted); }
.comments-list .body { color: #495057; font-size: 13.5px; white-space: pre-wrap; }
.comments-list .private { background: var(--orange-bg); color: var(--orange); padding: 1px 6px; border-radius: 3px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }

/* ============= Right-rail "NEXT FORM" / "TOTAL" buttons =============
   Two stacked vertical tabs anchored to the right edge of the viewport on
   form view pages. Vertical text via CSS writing-mode (no transform tricks
   so the click area stays correct). */
.form-rail {
  position: fixed;
  top: 30%;
  right: 0;
  z-index: 1020;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-height: 110px;
  padding: 12px 4px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  border-radius: 3px 0 0 3px;
  box-shadow: -1px 1px 2px rgba(0,0,0,.06);
  transition: transform .12s, filter .12s;
}
.form-rail-btn.next   { background: #2D2F36; }   /* dark slate */
.form-rail-btn.total  { background: #DC2626; }   /* red — count badge */
.form-rail-btn:hover  { transform: translateX(-2px); filter: brightness(1.08); color: #fff; }
.form-rail-btn.disabled {
  background: #9CA3AF;
  pointer-events: none;
  cursor: not-allowed;
  opacity: .75;
}
.form-rail-btn .rotate {
  writing-mode: vertical-rl;
  transform: rotate(180deg);   /* text reads bottom-to-top */
  white-space: nowrap;
}

/* Don't let the rail crowd content on narrow screens. */
@media (max-width: 900px) {
  .form-rail { display: none; }
}

/* ============= Items read-view table — flat layout =============
   Used by gform.php to render the line-item rows on a form's view page.
   Goals: quiet typography, generous row height, restrained header,
   numbers right-aligned with tabular figures, RTL Arabic cells aligned right. */
.items-view-wrap {
  margin: 14px 0;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
}
.items-view-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  color: #111827;
}
.items-view-table thead th {
  background: #374151;
  color: #fff;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 0;
  vertical-align: middle;
  white-space: nowrap;
}
.items-view-table thead th.num        { text-align: right; }
.items-view-table thead th.attach-col { text-align: center; width: 140px; }
.items-view-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
  border-top: 1px solid #F1F3F5;
  line-height: 1.45;
  color: #1F2937;
}
.items-view-table tbody tr:first-child td { border-top: 0; }
.items-view-table tbody tr:hover td { background: #F9FAFB; }
.items-view-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #111827;
  width: 1%;
  white-space: nowrap;
}
.items-view-table tbody td.rtl  { text-align: right; direction: rtl; }
.items-view-table tbody td.attach-col { text-align: center; padding: 8px 14px; }
.items-view-table tbody td.attach-col img {
  max-width: 84px;
  max-height: 56px;
  object-fit: cover;
  border: 1px solid #E5E7EB;
  border-radius: 3px;
  padding: 2px;
  background: #fff;
}

/* ============= SIGNATURE CARDS — flat layout ============= */
/* Design rules:
   - no drop shadow, no hover lift (flat)
   - 1px border in the same family as the header tint
   - solid colored header strip carries the role + status
   - body is plain white, centered, with consistent rhythm  */
.signers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.signer-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
/* ===== Premium signer-card design ===== */

/* ===== Premium signer timeline (horizontal stepper above the grid) ===== */
.signer-tl {
  display: flex; align-items: flex-start;
  gap: 0;
  padding: 20px 18px 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFC 100%);
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.signer-tl .tl-step {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  min-width: 130px;
  max-width: 170px;
}
.signer-tl .tl-circle {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700; font-size: 17px;
  background: #D1D5DB;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px #D1D5DB, 0 2px 6px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .25s ease;
}
.signer-tl .tl-circle .mdi { font-size: 22px; line-height: 1; }
.signer-tl .tl-step:hover .tl-circle { transform: scale(1.05); }

.signer-tl .tl-done .tl-circle {
  background: linear-gradient(135deg, #16A34A, #15803D);
  box-shadow: 0 0 0 2px #15803D, 0 2px 8px rgba(21,128,61,.25);
}
.signer-tl .tl-current .tl-circle {
  background: linear-gradient(135deg, #2563EB, #1F4E78);
  box-shadow: 0 0 0 2px #1F4E78, 0 2px 10px rgba(31,78,120,.35);
  animation: tl-pulse 2s ease-in-out infinite;
}
.signer-tl .tl-rejected .tl-circle {
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  box-shadow: 0 0 0 2px #B91C1C, 0 2px 8px rgba(185,28,28,.25);
}
.signer-tl .tl-pending .tl-circle {
  background: linear-gradient(135deg, #F3F4F6, #E5E7EB);
  color: #6B7280;
  box-shadow: 0 0 0 2px #D1D5DB;
}
.signer-tl .tl-circle .tl-ini { font-size: 16px; letter-spacing: .5px; }
@keyframes tl-pulse {
  0%, 100% { box-shadow: 0 0 0 2px #1F4E78, 0 2px 10px rgba(31,78,120,.35); }
  50%      { box-shadow: 0 0 0 8px rgba(31,78,120,.18), 0 2px 14px rgba(31,78,120,.45); }
}

.signer-tl .tl-meta { margin-top: 10px; max-width: 150px; }
.signer-tl .tl-role {
  font-size: 11.5px; font-weight: 700; color: #1F2937;
  letter-spacing: .2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.signer-tl .tl-name {
  font-size: 11.5px; color: #6B7280; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.signer-tl .tl-time {
  font-size: 10px; color: #9CA3AF; margin-top: 2px;
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
}
.signer-tl .tl-done .tl-time { color: #15803D; }
.signer-tl .tl-current .tl-time { color: #1F4E78; }
.signer-tl .tl-rejected .tl-time { color: #B91C1C; }

.signer-tl .tl-line {
  flex: 1; min-width: 30px;
  height: 3px; background: #E5E7EB;
  margin: 28px -6px 0;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.signer-tl .tl-line-done    { background: #15803D; }
.signer-tl .tl-line-current { background: linear-gradient(to right, #15803D 0%, #1F4E78 100%); }
.signer-tl .tl-line-pending { background: repeating-linear-gradient(90deg, #E5E7EB 0 6px, transparent 6px 10px); }

/* ===== Existing card-grid styling continues below ===== */
.signer-card { transition: transform .15s ease, box-shadow .15s ease, filter .25s ease; }

/* Current actionable card — soft navy ring + slow pulse to draw the eye. */
.signer-card.is-current {
  border-color: #1F4E78;
  box-shadow: 0 0 0 3px rgba(31,78,120,.12), 0 4px 14px rgba(31,78,120,.08);
  animation: signer-pulse 2.4s ease-in-out infinite;
}
@keyframes signer-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(31,78,120,.12), 0 4px 14px rgba(31,78,120,.08); }
  50%      { box-shadow: 0 0 0 6px rgba(31,78,120,.18), 0 4px 18px rgba(31,78,120,.14); }
}

/* Done cards — subtle green tint on hover, calm by default. */
.signer-card.is-done { border-color: #D1FAE5; }
.signer-card.is-done:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(21,128,61,.10); }

/* Future-rank waiting cards — desaturated to step back visually. Lighter
   slate head + clock prefix + soft "awaiting" hint inside the body. */
.signer-card.waiting-prev {
  filter: grayscale(60%);
  opacity: 0.82;
}
.signer-card.waiting-prev:hover {
  filter: grayscale(0%); opacity: 1;
}
.signer-card.waiting-prev .head { background: #6B7280; }
.signer-card .head-prefix {
  font-size: 14px; color: rgba(255,255,255,.85);
  margin-right: 6px; flex: 0 0 auto;
}
.signer-card .wait-text {
  color: #6B7280; font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 500;
}
.signer-card .wait-text .mdi { font-size: 13px; color: #9CA3AF; }
.signer-card .head {
  background: #374151;        /* slate-700 — flat dark for waiting */
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  border-bottom: 0;
}
.signer-card .head .role-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #fff;
}
.signer-card .head .head-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent;
  color: rgba(255,255,255,.85);
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s;
}
.signer-card .head .head-icon:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.signer-card .head .head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.signer-card .body {
  padding: 16px 14px;
  text-align: center;
  min-height: 130px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  background: #fff;
}
.signer-card .name {
  font-weight: 600;
  font-size: 13.5px;
  color: #111827;
  margin: 0 0 2px;
}
.signer-card .sig-img {
  max-width: 130px;
  max-height: 54px;
  margin: 2px auto;
  filter: none;
}
.signer-card .sig-placeholder {
  width: 130px; height: 50px;
  display: grid; place-items: center;
  background: #F9FAFB;
  color: #9CA3AF;
  border: 1px dashed #E5E7EB;
  border-radius: 3px;
  font-size: 11px;
  margin: 2px auto;
}
.signer-card .ts {
  font-size: 11.5px;
  color: #6B7280;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* All signer cards share the same flat dark header — the status is
   communicated by the body stamp (Approved / Rejected) or the action
   icons, not by header color. */
.signer-card .head { background: #374151; }     /* slate-700 */
.signer-card        { border-color: #E5E7EB; }

/* Subtle amber strip on top of the active card so users can spot their own
   row quickly without colouring the whole header. */
.signer-card.pending.current { position: relative; }
.signer-card.pending.current::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: #F59E0B;
}

/* Section heading for the Signers row — flat, no card chrome */
.signers-section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 0;
  padding: 0 0 8px;
  border-bottom: 1px solid #E5E7EB;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #374151;
}
.signers-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: #F59E0B;
  border-radius: 1px;
}

/* Form hero card: logo left, form info right (matches Out Going layout) */
.form-hero { background: #fff; border-radius: 6px; border: 1px solid var(--line); padding: 22px; margin-bottom: 16px; }
.form-hero .row { align-items: flex-start; }
.form-hero .hero-logo {
  width: 100%;
  min-height: 150px;
  background: #f8f9fa; border: 1px dashed var(--line-2);
  border-radius: 4px;
  display: grid; place-items: center;
  color: #adb5bd;
  font-size: 14px;
  font-weight: 600;
}
/* when a real logo is present, drop the placeholder box/background entirely */
.form-hero .hero-logo.has-logo { background: transparent; border: 0; min-height: 0; }
.form-hero .hero-logo img { max-width: 262px; max-height: 158px; }
.form-hero h4 {
  margin: 0 0 12px;
  font-size: 22px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 12px;
}
.form-hero h4 .pdf-btn {
  width: 40px; height: 40px;
  background: #fff; color: var(--brand-red);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  text-decoration: none;
  transition: background .12s;
}
.form-hero h4 .pdf-btn:hover { background: var(--brand-red); color: #fff; }
/* Hero body: title + meta on the left, QR top-aligned on the right so it
   sits visually next to the module title (e.g. "Outgoing"), not buried
   beside the meta paragraph. */
.form-hero .hero-body-row {
  display: flex; align-items: flex-start; gap: 18px;
}
.form-hero .hero-body-text { flex: 1; min-width: 0; }
.form-hero .hero-meta {
  margin: 0;
  font-size: 13.5px; color: #6c757d;
  line-height: 1.85;
  padding-left: 18px;
}
.form-hero .hero-meta strong { color: var(--text); font-weight: 700; }
.form-hero .hero-qr {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  padding: 6px;
  align-self: flex-start;
}
.form-hero .hero-qr canvas { display: block; }

/* Horizontal details strip — striped key/value pairs (Reasons | Address | Department | Out With) */
.detail-strip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}
.detail-strip table { width: 100%; border-collapse: collapse; }
.detail-strip td { padding: 14px 12px; font-size: 13.5px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.detail-strip tr:last-child td { border-bottom: none; }
.detail-strip td.label { font-weight: 700; color: var(--text); white-space: nowrap; }
.detail-strip td.value { color: #495057; }
.detail-strip td.action { width: 1%; white-space: nowrap; text-align: right; }
.detail-strip td.rtl { direction: rtl; text-align: right; }

/* Item attach thumbnail */
.attach-thumb {
  width: 64px; height: 64px;
  display: inline-grid; place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--brand-red);
  font-size: 24px;
  text-decoration: none;
}
.attach-thumb:hover { background: #f8f9fa; }
.attach-thumb img { max-width: 60px; max-height: 60px; object-fit: contain; }
.attach-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* ============= TIMELINE ============= */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0 12px 28px; border-left: 2px solid var(--line); position: relative; margin-left: 8px; }
.timeline li::before {
  content: ""; position: absolute; left: -8px; top: 14px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #15803D; border: 3px solid #fff; box-shadow: 0 0 0 2px #15803D;
}
.timeline li.rej::before { background: #B91C1C; box-shadow: 0 0 0 2px #B91C1C; }
.timeline li.pending::before { background: var(--brand-orange); box-shadow: 0 0 0 2px var(--brand-orange); }
.timeline li .name { font-weight: 600; }
.timeline li .role { color: var(--muted); font-size: 12px; margin-left: 8px; }
.timeline li .ts { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.timeline li .reason { background: #FEE2E2; color: #B91C1C; padding: 4px 10px; border-radius: 4px; font-size: 12px; margin-top: 6px; display: inline-block; }

/* ============= APPROVAL PANEL ============= */
.approval-panel { display: flex; flex-direction: column; gap: 8px; }
.approval-panel .ap-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px;
  font-size: 13px; font-weight: 600;
  border: 1px solid; border-radius: 4px;
  cursor: pointer; font-family: inherit;
}
.approval-panel .ap-btn.approve { background: #15803D; color: #fff; border-color: #15803D; }
.approval-panel .ap-btn.approve:hover { background: #14532D; }
.approval-panel .ap-btn.reject { background: #fff; color: #B91C1C; border-color: #B91C1C; }
.approval-panel .ap-btn.reject:hover { background: #FEE2E2; }
.approval-panel textarea {
  width: 100%; min-height: 50px;
  padding: 8px 12px; border: 1px solid #d6dde6; border-radius: 4px;
  font-family: inherit; font-size: 13px;
}

/* ============= PAGER ============= */
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.pager .info { color: var(--muted); font-size: 12px; }
.pager .pages a, .pager .pages span {
  display: inline-block; padding: 4px 10px; border-radius: 4px;
  margin: 0 2px; font-size: 12.5px;
  color: var(--text); text-decoration: none;
}
.pager .pages a:hover { background: var(--sidebar-hover); }
.pager .pages .current { background: var(--table-head); color: #fff; font-weight: 600; }
.pager .pages .gap { color: var(--muted); }

/* ============= MISC ============= */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 36px; opacity: .35; margin-bottom: 6px; display: block; }
.muted { color: var(--muted); }
.dim   { color: var(--muted); font-size: 12px; }
.bar { background: var(--sidebar-bg); border-radius: 4px; height: 8px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; background: var(--table-head); height: 100%; }
.bar.green > span { background: #15803D; }
.bar.orange > span { background: var(--brand-orange); }
.rtl { direction: rtl; text-align: right; unicode-bidi: plaintext; font-family: "Segoe UI", Tahoma, Arial; }

.footer { padding: 12px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* ============= LOGIN ============= */
.login-wrap {
  display: grid; place-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #524e4c 0%, #2f2d2c 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 8px;
  padding: 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.login-card .brand {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.login-card .brand .logo-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--brand-red); color: #fff;
  border-radius: 8px; font-size: 24px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; font-weight: 700; }
.login-card .lead { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.login-card label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; display: block; }
.login-card input { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #d6dde6; border-radius: 4px; margin-top: 4px; font-family: inherit; }
.login-card input:focus { outline: 0; border-color: var(--sidebar-active); box-shadow: 0 0 0 .15rem rgba(55,65,81,.18); }
.login-card .err { background: #FEE2E2; color: #B91C1C; padding: 8px 12px; border-radius: 4px; font-size: 13px; margin-bottom: 12px; }
.login-card button {
  width: 100%; padding: 11px; background: var(--table-head); color: #fff;
  border: none; border-radius: 4px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  margin-top: 6px;
}
.login-card button:hover { background: #0a4760; }
.login-card .foot { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ============= RESPONSIVE ============= */
@media (max-width: 800px) {
  .sidebar { display: none; }
}

/* ============= PRINT ============= */
@media print {
  .no-print, .topbar, .sidebar, .page-breadcrumb { display: none !important; }
  #main-wrapper { padding-top: 0 !important; }
  .page-wrapper { background: #fff !important; margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
  .approval-panel { display: none !important; }
  body { background: #fff !important; }
  @page { margin: 1.5cm; size: A4; }
}

/* ============ Approve / Reject / Reback — bare colored icons in the card body ============ */
.signer-card .body.has-action {
  padding: 18px 14px;
  min-height: 130px;
  align-items: center;
  justify-content: center;
}
.signer-card .signer-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;        /* a bit more breathing room since there's no frame */
  flex-wrap: wrap;
  width: 100%;
}
.signer-card .signer-action .approve-form { margin: 0; display: inline-block; }
/* Bare colored icons — no frame, no background. */
.signer-card .signer-action .sign-btn {
  background: transparent;
  border: 0;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 28px;          /* big enough to read at a glance */
  line-height: 1;
  transition: transform .08s, opacity .12s;
}
.signer-card .signer-action .sign-btn:hover  { transform: scale(1.12); }
.signer-card .signer-action .sign-btn:active { transform: scale(0.96); }
.signer-card .signer-action .sign-btn:focus  { outline: none; }
.signer-card .signer-action .sign-btn-approve { color: #16A34A; }   /* green */
.signer-card .signer-action .sign-btn-reject  { color: #DC2626; }   /* red   */
.signer-card .signer-action .sign-btn-reback  { color: #F59E0B; }   /* amber */
.signer-card .signer-action .approve-form { margin: 0; display: inline-block; line-height: 0; }

/* Reject reason modal — polish */
.modal-content.sign-modal .modal-header {
  border-bottom: 1px solid #f1f3f5;
  padding: 14px 18px;
}
.modal-content.sign-modal .modal-header .modal-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700;
}
.modal-content.sign-modal .modal-header .modal-title .text-muted {
  font-weight: 500; font-size: 13px;
}
.modal-content.sign-modal .modal-body { padding: 18px; }
.modal-content.sign-modal .modal-body textarea {
  font-size: 13.5px;
  line-height: 1.5;
  border-color: #e3e6eb;
}
.modal-content.sign-modal.reject-modal .modal-body textarea:focus {
  border-color: #B91C1C;
  box-shadow: 0 0 0 .15rem rgba(185,28,28,.12);
}
.modal-content.sign-modal.reback-modal .modal-body textarea:focus {
  border-color: #EAB308;
  box-shadow: 0 0 0 .15rem rgba(234,179,8,.18);
}
.modal-content.sign-modal .modal-footer {
  border-top: 1px solid #f1f3f5;
  padding: 12px 18px;
}

/* ============================================================
   Shared drag-and-drop uploader — used everywhere attachments
   are accepted. Initialised by inc/dropzone.php auto-script.
   ============================================================ */
.dz-wrap            { margin-top: 6px; }
.dz-wrap .dz-zone   {
  position: relative;
  border: 2px dashed #cbd0d8;
  border-radius: 4px;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  background: #fafbfc;
}
.dz-wrap .dz-zone.dz-over { background: #f0f7ff; border-color: #93b4d8; }
.dz-wrap .dz-zone .dz-input {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.dz-wrap .dz-caption {
  color: #c9a48a; font-size: 26px; font-style: italic; font-weight: 300;
  text-align: center;
}
.dz-wrap .dz-close {
  position: absolute; top: 8px; right: 12px;
  font-size: 18px; color: #98a2b3; cursor: pointer;
  line-height: 1; user-select: none; z-index: 2;
}
.dz-wrap .dz-browse {
  display: flex; align-items: stretch;
  border: 1px solid #e3e6eb; border-top: 0; background: #fff;
}
.dz-wrap .dz-files {
  flex: 1; padding: 8px 12px; color: #98a2b3; font-size: 13px;
  align-self: center;
}
.dz-wrap .dz-btn {
  background: #2a2f36; color: #fff; padding: 8px 18px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px; margin: 0;
}
.dz-wrap .dz-btn:hover { background: #1a1f26; }
.dz-wrap .dz-submit {
  background: #0f9fbb; color: #fff; padding: 8px 18px; border: 0;
  font-weight: 700; letter-spacing: .5px; font-size: 13px;
}
.dz-wrap .dz-submit:hover { background: #0d8a9f; }
.dz-wrap .dz-list { list-style: none; margin: 10px 0 0; padding: 0; }
.dz-wrap .dz-list li {
  font-size: 13px; padding: 4px 0; border-bottom: 1px solid #f1f3f5;
  display: flex; align-items: center; gap: 8px;
}
.dz-wrap .dz-list li:last-child { border-bottom: 0; }
.dz-wrap .dz-list a { color: #1F4E78; text-decoration: none; flex: 1; }
.dz-wrap .dz-list a:hover { text-decoration: underline; }
.dz-wrap .dz-list .dz-dl { flex: 0 0 auto; color: #6B7280; }


/* Bootstrap-datepicker — a touch wider + comfier cells so the calendar
   does not feel cramped next to bootstrap-select buttons. */
.datepicker.datepicker-dropdown { min-width: 360px; padding: 10px; }
.datepicker table { width: 100%; }
.datepicker table td,
.datepicker table th { padding: 8px 14px; font-size: 15px; }
.datepicker table td.day,
.datepicker table td.day.old,
.datepicker table td.day.new { min-width: 38px; height: 38px; font-size: 15px; font-weight: 500; }
.datepicker table th.dow { font-size: 12px; color: #6B7280; font-weight: 600; text-transform: uppercase; }
.datepicker .datepicker-switch { font-size: 15px; font-weight: 700; }
.datepicker .prev, .datepicker .next { font-size: 18px; font-weight: 700; }
/* Month / year / decade / century pickers — keep them readable too. */
.datepicker .datepicker-months .month,
.datepicker .datepicker-years .year,
.datepicker .datepicker-decades .decade,
.datepicker .datepicker-centuries .century { font-size: 14px; padding: 8px 4px; }

/* Calendar-icon addon attached by inc/layout.php to every datepicker. */
.input-group.date .input-group-addon,
.input-group.date .wf-dp-icon {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; background: #F1F5F9; color: #0F597A;
  border: 1px solid #ced4da; border-left: 0; cursor: pointer;
  border-top-right-radius: 4px; border-bottom-right-radius: 4px;
}
.input-group.date .input-group-addon:hover,
.input-group.date .wf-dp-icon:hover { background: #E2E8F0; }
.input-group.date .calendar-icon { font-size: 14px; }
