:root {
  --ink: #0c1a28;
  --ink-soft: #243746;
  --paper: #dce8ea;
  --paper-2: #c5d8dc;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.97);
  --surface-solid: #ffffff;
  --line: rgba(12, 26, 40, 0.12);
  --ocean: #0a7c76;
  --ocean-deep: #065a56;
  --amber: #c46b1a;
  --teal: #1b7f92;
  --rose: #a33b4a;
  --glow: rgba(10, 124, 118, 0.28);
  --shadow: 0 18px 42px rgba(12, 26, 40, 0.1);
  --shadow-lg: 0 26px 58px rgba(12, 26, 40, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: #f4f8f9;
  --sidebar-2: #e8f1f2;
}

html[lang="hi"] {
  --font-body: "Nirmala UI", "Mangal", "Lohit Devanagari", "Manrope", sans-serif;
  --font-display: "Nirmala UI", "Mangal", "Lohit Devanagari", Georgia, serif;
}
html[lang="hi"] .workspace-chip,
html[lang="hi"] .nav-text strong {
  white-space: normal;
}

* { box-sizing: border-box; }

/* App shell owns scroll — avoid document scrollbar flicker (not on auth pages) */
html:has(body.app-body) {
  height: 100%;
  overflow: hidden;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  /* Match Manrope x-height so fallback metrics stay close if optional font misses the swap window */
  font-size-adjust: 0.52;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  -webkit-hyphens: none;
  color: var(--ink);
  background-color: #c9e0e4;
  background-image:
    radial-gradient(ellipse 900px 520px at -6% -14%, rgba(12, 186, 168, 0.55), transparent 58%),
    radial-gradient(ellipse 820px 480px at 108% -10%, rgba(36, 142, 178, 0.42), transparent 56%),
    radial-gradient(ellipse 680px 400px at 96% 112%, rgba(230, 150, 48, 0.3), transparent 52%),
    radial-gradient(ellipse 540px 340px at 4% 96%, rgba(8, 132, 118, 0.28), transparent 54%),
    linear-gradient(148deg, #d8f3ee 0%, #c8e6f0 36%, #e4ecd8 68%, #d2e4e8 100%);
  background-attachment: fixed;
}

/* App shell owns scroll; login/auth pages scroll normally */
body.app-body {
  height: 100%;
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  min-width: 280px;
  max-width: 280px;
  padding: 1.25rem 1rem 1.1rem;
  background:
    linear-gradient(180deg, #f7fbfb 0%, #eef4f6 100%);
  color: #16324a;
  box-shadow:
    inset -1px 0 0 rgba(15, 40, 55, 0.08),
    8px 0 24px rgba(15, 40, 55, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.2rem;
  margin-bottom: 0;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(22, 50, 74, 0.22);
  border-radius: 99px;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem 1rem;
  border-bottom: 1px solid rgba(22, 50, 74, 0.1);
  margin-bottom: 0.9rem;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  opacity: 0.65;
  line-height: 1.35;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.nav-list > .nav-group > a.nav-link,
.nav-list > .nav-group > button.nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-sizing: border-box;
  font: inherit;
  color: #2a3f54;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-list a:hover {
  background: #e7f5f3;
  color: #0a7c76;
  transform: translateX(2px);
  box-shadow: inset 3px 0 0 #0a7c76;
}

.nav-list > .nav-group > a.is-active {
  background: #e7f5f3;
  color: #065a56;
  transform: translateX(2px);
  box-shadow: inset 3px 0 0 #f37e20;
}

.nav-code {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  opacity: 0.55;
}

.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: clip;
  padding: 1.15rem 1.45rem 2.4rem;
  position: relative;
  /* Keep width stable when the vertical scrollbar appears after content paints */
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding: 0.95rem 1.15rem;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.72), rgba(247,251,251,0.55)),
    rgba(255,255,255,0.45);
  border: 1px solid rgba(13, 27, 42, 0.08);
  box-shadow: 0 10px 28px rgba(13, 27, 42, 0.05);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(1.55rem, 2vw, 2.05rem);
  letter-spacing: -0.02em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.lang-switch {
  flex: 0 0 auto;
}
.lang-switch select {
  appearance: none;
  -webkit-appearance: none;
  height: 2.55rem;
  padding: 0 1.7rem 0 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(13, 27, 42, 0.1);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23065a56' d='M1 1.2 6 6.2 11 1.2'/%3E%3C/svg%3E")
    no-repeat right 0.65rem center,
    rgba(255, 255, 255, 0.9);
  color: var(--ocean-deep);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(13, 27, 42, 0.05);
}
.lang-switch select:focus {
  outline: 2px solid rgba(10, 124, 118, 0.35);
  outline-offset: 1px;
}
.auth-brand-row .lang-switch {
  margin-left: auto;
}

.topbar-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 12px;
  color: var(--ocean-deep);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(13, 27, 42, 0.1);
  box-shadow: 0 6px 16px rgba(13, 27, 42, 0.05);
  transition: transform 160ms ease, background 160ms ease;
}
.topbar-bell:hover {
  transform: translateY(-1px);
  background: #fff;
  color: var(--ocean);
}
.topbar-bell .ui-icon { width: 1.2rem; height: 1.2rem; }
.topbar-bell-count {
  position: absolute;
  top: 0.2rem;
  right: 0.15rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: #b34452;
  border: 2px solid #fff;
}
.topbar-bell.has-unread {
  box-shadow: 0 0 0 2px rgba(179, 68, 82, 0.18), 0 6px 16px rgba(13, 27, 42, 0.05);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.1;
  text-decoration: none;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background 180ms ease, border-color 180ms ease, color 180ms ease, filter 180ms ease;
}
.btn .ui-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0d8a84, var(--ocean-deep));
  color: #f7fffe;
  box-shadow: 0 10px 24px var(--glow);
}

.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  color: #f4efe6;
  border: 1px solid rgba(255,255,255,0.16);
}

.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.9)),
    var(--surface-solid);
  border: 1px solid rgba(12, 26, 40, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, rgba(10,124,118,0.7), rgba(27,127,146,0.4), rgba(196,107,26,0.28));
  opacity: 0.9;
  pointer-events: none;
}

.panel-pad { padding: 1.15rem 1.2rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 1rem 1.05rem 1.1rem;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.22;
}

.stat-card.tone-ocean::after { background: var(--ocean); }
.stat-card.tone-amber::after { background: var(--amber); }
.stat-card.tone-teal::after { background: var(--teal); }
.stat-card.tone-rose::after { background: var(--rose); }

.stat-label {
  font-size: 0.82rem;
  color: #2a3f52;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: -0.03em;
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.35rem;
  align-items: start;
}

.section-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.module-grid,
.menu-grid {
  display: grid;
  gap: 0.75rem;
}

.module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.module-card,
.menu-card {
  display: block;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  text-decoration: none;
  color: inherit;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
a.menu-card {
  cursor: pointer;
  display: block;
  color: inherit;
  text-decoration: none;
}
.section-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.section-head-row .section-subtitle { margin: 0; }

.module-card:hover,
.menu-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 110, 106, 0.35);
  box-shadow: 0 12px 28px rgba(15, 28, 46, 0.08);
}

.module-code {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ocean);
  font-weight: 700;
}

.module-name,
.menu-card strong {
  display: block;
  margin: 0.35rem 0 0.25rem;
  font-size: 1.02rem;
}

.module-desc,
.menu-card span {
  color: #2a3f52;
  font-size: 0.88rem;
  line-height: 1.45;
}

.pipeline {
  display: grid;
  gap: 0.65rem;
}

.pipeline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 28, 46, 0.08);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ocean), #1f9e97);
}

.auth-card a {
  color: var(--ocean-deep);
  font-weight: 650;
}

.sidebar-footer .btn + form {
  margin-top: 0.55rem;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
  padding: 1.6rem;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.8rem;
}

.auth-card p {
  margin: 0 0 1.2rem;
  color: var(--ink-soft);
}

.form-field {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.05rem;
  min-width: 0;
  align-content: start;
}
.field-hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.data-table-compact thead th {
  padding: 0.65rem 0.7rem;
  font-size: 0.72rem;
}
.data-table-compact tbody td {
  padding: 0.65rem 0.7rem;
  font-size: 0.84rem;
}

.form-field label {
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
}

.req-mark {
  color: #c2410c;
  font-weight: 700;
  margin-left: 0.15em;
  line-height: 1;
}

.form-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
}

.form-field input:focus {
  outline: 2px solid rgba(11, 110, 106, 0.28);
  border-color: var(--ocean);
}

.messages {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.messages li {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #fff4e8;
  border: 1px solid rgba(196, 107, 26, 0.25);
  margin-bottom: 0.45rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes grow {
  from { width: 0 !important; }
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .module-grid,
  .menu-grid { grid-template-columns: 1fr; }
}

.sidebar-footer {
  margin-top: auto;
  padding: 1.4rem 0.6rem 0;
}

.btn-block { width: 100%; }
.btn-secondary {
  background: linear-gradient(160deg, rgba(11, 110, 106, 0.16), rgba(31, 122, 140, 0.14));
  color: var(--ocean-deep);
  border: 1px solid rgba(11, 110, 106, 0.32);
  box-shadow: 0 6px 16px rgba(11, 110, 106, 0.1);
}
.btn-secondary:hover {
  border-color: rgba(11, 110, 106, 0.5);
  background: linear-gradient(160deg, rgba(11, 110, 106, 0.22), rgba(31, 122, 140, 0.2));
  transform: translateY(-1px);
  color: #064843;
}
.btn-amber {
  background: linear-gradient(135deg, #d7862b, #a85812);
  color: #fffaf3;
  border: 1px solid rgba(168, 88, 18, 0.45);
  box-shadow: 0 8px 20px rgba(196, 107, 26, 0.22);
}
.btn-amber:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-teal {
  background: linear-gradient(135deg, #2493a8, #176577);
  color: #f4fcfe;
  border: 1px solid rgba(23, 101, 119, 0.4);
  box-shadow: 0 8px 20px rgba(31, 122, 140, 0.22);
}
.btn-teal:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-soft {
  background: rgba(15, 28, 46, 0.06);
  color: var(--ink);
  border: 1px solid rgba(15, 28, 46, 0.12);
}
.btn-soft:hover {
  background: rgba(15, 28, 46, 0.1);
  transform: translateY(-1px);
}
.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 10px;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.page-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.stack { display: grid; gap: 1.15rem; }
.stack-sm { display: grid; gap: 0.9rem; }
.mb-1 { margin-bottom: 1.15rem; }
.mt-1 { margin-top: 1.15rem; }
.text-muted {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 100%;
  opacity: 1;
}
.lead-copy {
  margin: 0;
  color: var(--ink-soft);
  max-width: 52ch;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.35rem;
  align-items: start;
}
.form-grid .form-field { margin-bottom: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.35rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--line);
}
.form-grid > .form-actions,
.form-grid > .form-actions.span-2 {
  margin-top: 0.15rem;
}

.field-control,
.form-field select,
.form-field textarea,
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.field-control:focus,
.form-field select:focus,
.form-field textarea:focus,
.form-field input:focus {
  outline: 2px solid rgba(11, 110, 106, 0.28);
  border-color: var(--ocean);
}

.form-field.has-error .field-control,
.form-field.has-error select,
.form-field.has-error textarea,
.form-field.has-error input,
.field-control.is-invalid,
input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.ts-wrapper.is-invalid .ts-control {
  border-color: #b34452;
  outline: 2px solid rgba(179, 68, 82, 0.2);
}

.field-error-msg,
span.field-error-msg {
  display: block;
  margin-top: 0.4rem;
  color: #a33b4a;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}

.form-field .helptext,
.form-field .errorlist {
  font-size: 0.78rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.form-field .errorlist {
  color: var(--rose);
  margin-top: 0.35rem;
  font-weight: 650;
}
.form-field .errorlist li { margin: 0; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.8rem;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}
.data-table {
  width: 100%;
  /* separate — collapse + sticky thead overlaps first body row in Chromium */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.8rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}
.data-table thead th {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #243746;
  font-weight: 750;
  background: #e8f3f3;
  border-bottom: 1px solid rgba(12, 26, 40, 0.12);
  white-space: nowrap;
  line-height: 1.35;
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background 140ms ease;
}
.data-table tbody tr:hover {
  background: rgba(11, 110, 106, 0.05);
}
.data-table tbody tr:first-child td {
  /* keep first data row clear of header */
  border-top: 0;
}
.data-table a {
  color: var(--ocean-deep);
  font-weight: 650;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.72rem 0.34rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  background: rgba(15, 28, 46, 0.1);
  color: #1a2b3c;
  border: 1px solid rgba(15, 28, 46, 0.14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  white-space: nowrap;
  max-width: 100%;
  vertical-align: middle;
}
.status-badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* Neutral / early */
.status-draft,
.status-new,
.status-inactive,
.status-uploaded,
.status-closed,
.status-restructured,
.status-cancelled,
.status-released {
  background: #e8eef2;
  color: #243747;
  border-color: #b7c4d0;
}

/* In progress — teal */
.status-submitted,
.status-prelim_validation,
.status-kyc,
.status-doc_verify,
.status-documentation,
.status-entity_appraisal,
.status-credit_rating,
.status-tech_appraisal,
.status-fin_appraisal,
.status-credit_assessment,
.status-security_creation,
.status-pre_disburse,
.status-pending_disbursement,
.status-planned,
.status-scheduled,
.status-open,
.status-due,
.status-under_verification,
.status-in_progress,
.status-acknowledged,
.status-contacted,
.status-qualified,
.status-ready {
  background: #d7f1f4;
  color: #0a5563;
  border-color: #7ebcc8;
}

/* Waiting / attention — amber */
.status-appraisal,
.status-committee,
.status-risk_review,
.status-partially_disbursed,
.status-partial,
.status-refresh_required,
.status-expired,
.status-pending,
.status-proposed,
.status-legal {
  background: #fde8cc;
  color: #8a3d05;
  border-color: #e3a45a;
  font-weight: 850;
}

/* Healthy / done — green */
.status-approved,
.status-sanctioned,
.status-disbursement_ready,
.status-active,
.status-disbursed,
.status-paid,
.status-verified,
.status-completed,
.status-converted,
.status-settled,
.status-done,
.status-met,
.status-created {
  background: #d4f3e8;
  color: #065a45;
  border-color: #6fbfa0;
}

/* Problem — rose (high visibility) */
.status-rejected,
.status-returned,
.status-overdue,
.status-npa,
.status-written_off,
.status-fail,
.status-failed,
.status-dropped,
.status-lost,
.status-error {
  background: #fadce1;
  color: #8a1f32;
  border-color: #d98a98;
  box-shadow: 0 0 0 1px rgba(163, 59, 74, 0.12);
  font-weight: 850;
}

.status-waived {
  background: #ece7f5;
  color: #4a3a6b;
  border-color: #b5a6d4;
}

.filter-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 1rem;
}
.filter-bar .form-field { margin-bottom: 0; min-width: 180px; }
.search-field { min-width: 240px; flex: 1; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.2rem;
}
.detail-item dt {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}
.detail-item dd {
  margin: 0.25rem 0 0;
  font-size: 0.98rem;
}
.detail-grid .span-2 { grid-column: 1 / -1; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.timeline-item {
  position: relative;
  padding-left: 1.1rem;
  border-left: 2px solid rgba(11, 110, 106, 0.25);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ocean);
}
.timeline-meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.timeline-title {
  font-weight: 700;
  margin: 0.15rem 0;
}

.empty-state {
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--ink-soft);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chip {
  display: inline-flex;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  font-size: 0.8rem;
  font-weight: 650;
}
.chip.is-active {
  background: rgba(11, 110, 106, 0.12);
  border-color: rgba(11, 110, 106, 0.35);
  color: var(--ocean-deep);
}

.wizard-steps {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(13, 27, 42, 0.08);
}
.wizard-step {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(13, 27, 42, 0.06);
  color: var(--ink-soft);
}
.wizard-step.is-active {
  background: linear-gradient(135deg, rgba(10,124,118,0.22), rgba(27,127,146,0.18));
  color: var(--ocean-deep);
  box-shadow: 0 6px 16px rgba(10,124,118,0.12);
}

.messages li.success {
  background: rgba(11, 110, 106, 0.1);
  border-color: rgba(11, 110, 106, 0.25);
}
.messages li.error {
  background: rgba(163, 59, 74, 0.1);
  border-color: rgba(163, 59, 74, 0.25);
}

@media (max-width: 900px) {
  .form-grid,
  .detail-grid { grid-template-columns: 1fr; }
}

/* ===== UI refresh: shell, auth, profile, LOS flow ===== */
.app-body {
  background:
    radial-gradient(900px 500px at 0% 0%, rgba(11,110,106,.14), transparent 55%),
    radial-gradient(800px 420px at 100% 10%, rgba(31,122,140,.12), transparent 50%),
    linear-gradient(165deg, #f4f0e8 0%, #ebe4d8 48%, #e5ddd0 100%);
}

.brand-copy { min-width: 0; }

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #1aa39b, #0b6e6a);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11,110,106,.35);
  flex-shrink: 0;
}

.nav-section-label {
  margin: 0.2rem 0.7rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  color: #4a5a72;
}

.nav-sub-section {
  list-style: none;
  margin: 0.55rem 0 0.15rem;
  padding: 0;
}

.nav-sub-section .nav-section-label {
  display: block;
  margin: 0.35rem 0.55rem 0.2rem;
  opacity: 0.55;
}

.nav-link {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start !important;
}

.nav-icon {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #e7f5f3;
  color: #0a7c76;
  font-size: 0.85rem;
  overflow: hidden;
}

.nav-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  flex: 1 1 auto;
}

.nav-text strong {
  font-size: 0.92rem;
  font-weight: 650;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.nav-text small { font-size: 0.68rem; letter-spacing: 0.08em; opacity: 0.78; color: #5b6b82; }

/* No translateY entrance — it caused a one-shot content jump after paint on every page */
.page-body { animation: none; text-wrap: pretty; }

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ocean-deep);
  font-weight: 800;
}

.topbar-copy h1 { margin: 0; }

.pill-soft {
  background: rgba(11,110,106,0.1);
  border-color: rgba(11,110,106,0.18);
  color: var(--ocean-deep);
}

.profile-menu { position: relative; z-index: 110; }
.profile-menu-top { flex-shrink: 0; }
.profile-trigger {
  width: auto;
  max-width: 260px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.65rem 0.4rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  box-shadow: 0 8px 22px rgba(15, 28, 46, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.profile-trigger:hover {
  border-color: rgba(11, 110, 106, 0.28);
  box-shadow: 0 10px 26px rgba(15, 28, 46, 0.1);
  transform: translateY(-1px);
}
.profile-trigger[aria-expanded="true"] {
  border-color: rgba(11, 110, 106, 0.35);
  box-shadow: 0 0 0 3px rgba(11, 110, 106, 0.12);
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #c46b1a, #0b6e6a);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(11, 110, 106, 0.28);
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; border-radius: 18px; }
.profile-meta { flex: 1; min-width: 0; }
.profile-meta strong, .profile-meta small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-meta strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}
.profile-meta small {
  opacity: 0.72;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.profile-caret {
  opacity: 0.55;
  font-size: 0.75rem;
  margin-right: 0.15rem;
  transition: transform 160ms ease;
}
.profile-trigger[aria-expanded="true"] .profile-caret {
  transform: rotate(180deg);
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  bottom: auto;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.4rem;
  box-shadow: 0 18px 40px rgba(15, 28, 46, 0.16);
  z-index: 200;
  display: grid;
  gap: 0.15rem;
  color: #0f1c2e;
}
.profile-dropdown[hidden] { display: none !important; }
.profile-dropdown a,
.profile-dropdown button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #0f1c2e !important;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  opacity: 1;
}
.profile-dropdown .ui-icon {
  width: 1rem;
  height: 1rem;
  opacity: 1;
  color: #085652 !important;
  background: #085652;
}
.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background: rgba(11, 110, 106, 0.1);
  color: #085652 !important;
}

@media (max-width: 700px) {
  .profile-menu-top .profile-meta { display: none; }
  .profile-trigger {
    max-width: none;
    padding: 0.3rem;
    border-radius: 50%;
  }
  .profile-caret { display: none; }
}

.btn-danger {
  background: linear-gradient(135deg, #c44d5c, #8d2f3b);
  color: #fff;
  border: 1px solid rgba(141, 47, 59, 0.45);
  box-shadow: 0 10px 24px rgba(163,59,74,0.28);
}
.btn-danger:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-ghost-dark {
  background: rgba(15, 28, 46, 0.05);
  color: var(--ink);
  border: 1px solid rgba(15, 28, 46, 0.14);
}
.btn-ghost-dark:hover {
  background: rgba(15, 28, 46, 0.09);
  transform: translateY(-1px);
}

.action-stack { display: grid; gap: 0.7rem; }
.inline-actions {
  display: flex;
  gap: 0.7rem 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}
.inline-actions > .field-control,
.inline-actions > select,
.inline-actions > input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  flex: 1 1 13rem;
  min-width: 0;
}
.inline-actions > .btn {
  flex: 0 0 auto;
}
.condition-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
}
.sticky-panel { position: sticky; top: 5.1rem; z-index: 20; }

.flow-track {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.35rem;
  scrollbar-width: thin;
}
.flow-step {
  min-width: 6.75rem;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem;
  text-align: center;
  opacity: 1;
  padding: 0.7rem 0.45rem 0.6rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 28, 46, 0.1);
  background: rgba(255, 255, 255, 0.55);
  box-sizing: border-box;
  min-height: 5.75rem;
  transform: none;
}
.flow-step.is-done { opacity: 1; }
.flow-step.is-current { opacity: 1; }
.flow-dot {
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(15,28,46,0.2);
  box-shadow: 0 0 0 4px rgba(15,28,46,0.05);
  flex-shrink: 0;
}
.flow-step.is-done .flow-dot { background: var(--ocean); }
.flow-step.is-current .flow-dot {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(196,107,26,0.18);
  animation: pulseDot 1.6s ease infinite;
}
.flow-label {
  font-size: 0.68rem;
  line-height: 1.25;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 5px rgba(196,107,26,0.18); }
  50% { opacity: 0.92; box-shadow: 0 0 0 7px rgba(196,107,26,0.12); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.profile-hero-grid {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Auth stage */
.auth-body { min-height: 100vh; }
.auth-stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}
.auth-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(8,30,40,0.72), rgba(11,70,68,0.55)),
    url("https://images.unsplash.com/photo-1494412574643-ff495add386f?auto=format&fit=crop&w=1600&q=80") center/cover;
  color: #f7f3ea;
  padding: 3rem;
  display: flex;
  align-items: flex-end;
}
.auth-visual-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 20% 20%, rgba(26,163,155,0.35), transparent 60%),
    radial-gradient(500px 280px at 80% 70%, rgba(196,107,26,0.25), transparent 55%);
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  animation: floaty 9s ease-in-out infinite;
}
.auth-orb-a { width: 180px; height: 180px; background: #1aa39b; top: 12%; left: 10%; }
.auth-orb-b { width: 120px; height: 120px; background: #c46b1a; top: 28%; right: 14%; animation-delay: -2s; }
.auth-orb-c { width: 220px; height: 220px; background: #1f7a8c; bottom: 18%; left: 35%; animation-delay: -4s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.05); }
}
.auth-visual-copy h2 {
  margin: 0.35rem 0 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3rem);
  letter-spacing: -0.03em;
}
.auth-visual-copy p { margin: 0; opacity: 0.86; line-height: 1.55; }
.auth-panel-wrap {
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(500px 280px at 80% 0%, rgba(10,124,118,0.14), transparent 60%),
    #eef4f5;
}
.auth-card-elevated {
  width: min(440px, 100%);
  animation: rise 500ms ease both;
}
.auth-panel-fill {
  place-items: stretch;
  padding: 0;
  min-height: 100vh;
  height: 100%;
  background:
    radial-gradient(700px 420px at 100% 0%, rgba(10,124,118,0.12), transparent 55%),
    radial-gradient(520px 360px at 0% 100%, rgba(27,127,146,0.1), transparent 50%),
    #eef4f5;
  border: 0;
  box-shadow: none;
  animation: authPanelIn 700ms ease both;
}
.auth-panel-inner {
  width: 100%;
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  gap: 1.5rem;
  padding: clamp(2rem, 4.5vw, 4rem) clamp(1.75rem, 5.5vw, 5rem);
  background: rgba(255, 255, 255, 0.88);
  border-left: 1px solid rgba(13, 27, 42, 0.08);
  backdrop-filter: blur(10px);
}
.auth-panel-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 36rem;
  margin-inline: auto;
  align-self: stretch;
}
.auth-register.auth-stage,
.auth-register.auth-stage-wide {
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
}
.auth-register .auth-panel-main {
  max-width: 44rem;
  justify-content: flex-start;
  padding-top: 0.25rem;
}
.auth-register .auth-panel-inner {
  justify-content: flex-start;
  padding: clamp(1.35rem, 3vw, 2.4rem) clamp(1.5rem, 3.5vw, 3rem);
}
.auth-register .auth-panel-inner .auth-brand-row {
  margin-bottom: 1.15rem;
}
.auth-register .auth-panel-inner .auth-brand-row h1 {
  font-size: clamp(1.75rem, 2.2vw, 2.15rem);
}
.form-grid.auth-register-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem 1.25rem;
  margin-top: 0.35rem;
}
@media (max-width: 640px) {
  .form-grid.auth-register-grid {
    grid-template-columns: 1fr;
  }
}
.auth-register-form .form-actions {
  margin-top: 1.15rem;
}
.auth-register-grid .form-field {
  min-width: 0;
}
.auth-register-grid .helptext {
  margin-top: 0.4rem;
}
.auth-panel-inner .auth-form {
  width: 100%;
  max-width: none;
}
.auth-form-spacious {
  display: grid;
  gap: 1.15rem;
  margin-top: 0.25rem;
}
.auth-form-spacious .form-field {
  margin: 0;
}
.auth-form-spacious .form-field label {
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.45rem;
}
.field-control-lg {
  min-height: 3.15rem;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  border-radius: 14px;
}
.btn-lg {
  min-height: 3.25rem;
  padding: 0.9rem 1.25rem;
  font-size: 1.05rem;
  border-radius: 14px;
  letter-spacing: 0.01em;
}
.auth-panel-inner .auth-brand-row {
  margin-bottom: 1.75rem;
}
.auth-panel-inner .auth-brand-row h1 {
  font-size: clamp(2rem, 3vw, 2.55rem);
  letter-spacing: -0.03em;
}
.auth-panel-inner .auth-brand-row p {
  font-size: 1rem;
  margin-top: 0.3rem;
}
.auth-panel-inner .brand-badge {
  width: 3.1rem;
  height: 3.1rem;
  font-size: 1rem;
}
.auth-panel-inner .demo-user-panel {
  flex: 0 0 auto;
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
}
.auth-brand-row {
  display: flex;
  gap: 0.95rem;
  align-items: center;
  margin-bottom: 1.1rem;
}
.auth-brand-row h1 { margin: 0; font-family: var(--font-display); font-size: 1.55rem; }
.auth-brand-row p { margin: 0.15rem 0 0; color: var(--ink-soft); }
.auth-links { margin-top: 1.15rem; }
.auth-links a {
  color: var(--ocean-deep);
  font-weight: 650;
  font-size: 0.95rem;
  transition: color 160ms ease, opacity 160ms ease;
}
.auth-links a:hover { color: var(--ocean); }

/* Login entrance motion */
.auth-enter {
  opacity: 0;
  transform: translateY(14px);
  animation: authRise 620ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--auth-delay, 0ms);
}
.auth-visual-copy {
  position: relative;
  z-index: 1;
  max-width: 36rem;
  animation: authRise 800ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}
@keyframes authRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes authPanelIn {
  from { opacity: 0.55; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-enter,
  .auth-visual-copy,
  .auth-panel-fill,
  .auth-orb {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
.demo-creds {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.portal-hero {
  background:
    linear-gradient(135deg, rgba(11,110,106,0.12), rgba(196,107,26,0.08)),
    rgba(255,252,247,0.9);
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}
.portal-card {
  padding: 1.15rem;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.62);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.portal-card:hover {
  transform: translateY(-3px);
  border-color: rgba(11, 110, 106, 0.35);
  box-shadow: 0 18px 36px rgba(15,28,46,0.12);
}
.portal-card-index {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ocean);
}
.portal-card span { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.4; }

.status-uploaded { background: #e8eef2; color: #243747; border-color: #b7c4d0; }
.status-verified { background: #d4f3e8; color: #065a45; border-color: #6fbfa0; }

@media (max-width: 1100px) {
  .auth-stage,
  .auth-register.auth-stage,
  .auth-register.auth-stage-wide { grid-template-columns: 1fr; }
  .auth-visual { min-height: 240px; }
  .auth-panel-inner {
    min-height: auto;
    border-left: 0;
    padding: 2rem 1.35rem 1.5rem;
  }
  .auth-panel-main {
    justify-content: flex-start;
    padding-top: 0.5rem;
  }
  .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .portal-grid { grid-template-columns: 1fr; }
}

/* Nested left menu */
.nav-group { display: grid; gap: 0.2rem; }
.nav-parent {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.nav-caret {
  margin-left: auto;
  opacity: 0.55;
  transition: transform 160ms ease;
}
.nav-group.is-open > .nav-parent .nav-caret { transform: rotate(180deg); }
.nav-sub {
  list-style: none;
  margin: 0 0 0.35rem 2.4rem;
  padding: 0;
  display: none;
  gap: 0.15rem;
}
.nav-group.is-open > .nav-sub { display: grid; }
.nav-sub-link {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: #3a4f64;
  font-size: 0.86rem;
}
.nav-sub-link:hover {
  background: #e7f5f3;
  color: #0a7c76;
}

/* Masters: level-2 groups (System / Configuration / Catalogs) */
.nav-nested {
  gap: 0.1rem;
  margin: 0.1rem 0;
}
.nav-sub-parent {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: #16324a;
  font-size: 0.86rem;
  font-weight: 650;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  text-align: left;
}
.nav-sub-parent:hover {
  background: #e7f5f3;
  color: #0a7c76;
}
.nav-sub-parent .nav-caret {
  flex-shrink: 0;
  opacity: 0.65;
  font-size: 0.75rem;
  transition: transform 160ms ease;
}
.nav-nested.is-open > .nav-sub-parent {
  background: #e7f5f3;
  color: #065a56;
}
.nav-nested.is-open > .nav-sub-parent .nav-caret {
  transform: rotate(180deg);
}
.nav-nested-sub {
  list-style: none;
  margin: 0.1rem 0 0.35rem 0.55rem;
  padding: 0.15rem 0 0.1rem 0.55rem;
  display: none;
  gap: 0.12rem;
  border-left: 1px solid rgba(10, 124, 118, 0.22);
}
.nav-nested.is-open > .nav-nested-sub {
  display: grid;
}
.nav-nested-sub .nav-sub-link {
  font-size: 0.82rem;
  padding: 0.45rem 0.65rem;
  color: #3a4f64;
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  background: var(--amber);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

/* Charts, pipeline window, conditions, demo login, toasts */
.chart-panel .chart-wrap {
  position: relative;
  height: 300px;
  margin-top: 0.75rem;
}
.chart-wrap-donut { height: 280px; }
.pipeline-scroll {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.pipeline-header .section-title { margin: 0; }
.pipeline-pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.flow-track-window {
  overflow-x: auto;
  overflow-y: visible;
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.35rem 0.15rem 0.5rem;
  margin: 0;
  scrollbar-width: thin;
}
.flow-track-window .flow-step {
  flex: 1 1 0;
  min-width: 7rem;
  padding: 0.7rem 0.45rem 0.6rem;
  border-radius: 12px;
  min-height: 5.75rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.flow-track-window .flow-step[hidden] { display: none !important; }
.flow-step.is-done {
  opacity: 1;
  border-color: rgba(11,110,106,0.4);
  background: #d4f3e8;
  transform: none;
  box-shadow: none;
}
.flow-step.is-current {
  opacity: 1;
  z-index: 2;
  border: 1px solid #c46b1a;
  background: linear-gradient(165deg, #ffd9a3 0%, #f6b35a 48%, #e8952e 100%);
  box-shadow: 0 0 0 3px rgba(196, 107, 26, 0.22);
  transform: none;
}
.flow-step.is-current .flow-label {
  color: #4a2200;
  font-weight: 800;
}
.flow-step.is-current .flow-dot {
  background: #7a3d05;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.45);
  animation: pulseDot 1.6s ease infinite;
}
.flow-step.is-pending {
  opacity: 1;
  border-color: rgba(15,28,46,0.12);
  background: rgba(255,255,255,0.7);
  transform: none;
  box-shadow: none;
}
.flow-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
}
.flow-step.is-done .flow-state {
  color: #065a45;
  background: rgba(255,255,255,0.65);
  border-color: #6fbfa0;
}
.flow-step.is-current .flow-state {
  color: #fff;
  background: #8a3d05;
  border-color: #6f2f00;
  box-shadow: 0 2px 8px rgba(74, 34, 0, 0.25);
}
.flow-step.is-pending .flow-state {
  color: #4a5d6e;
  background: rgba(15,28,46,0.06);
  border-color: rgba(15,28,46,0.12);
}

.condition-row.is-completed {
  border-color: rgba(11,110,106,0.4);
  background: rgba(11,110,106,0.1);
}
.condition-row.is-pending {
  border-color: rgba(196,107,26,0.4);
  background: rgba(196,107,26,0.1);
}
.condition-status.status-badge {
  margin-left: 0.55rem;
}
.condition-row.is-completed .condition-status:not(.status-badge) {
  background: #d4f3e8;
  color: #065a45;
}
.condition-row.is-pending .condition-status:not(.status-badge) {
  background: #fde8cc;
  color: #8a3d05;
}

.highlight-metric dd {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--ocean-deep);
}
.sanction-card {
  background:
    linear-gradient(135deg, rgba(11,110,106,0.08), rgba(196,107,26,0.06)),
    var(--surface);
}

.demo-user-panel {
  margin-top: 0.85rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.7);
  overflow: hidden;
}
.demo-user-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 650;
  color: var(--ocean-deep);
  cursor: pointer;
}
.demo-user-toggle:hover { background: rgba(11,110,106,0.06); }
.demo-user-caret {
  opacity: 0.55;
  transition: transform 160ms ease;
}
.demo-user-panel.is-open .demo-user-caret { transform: rotate(180deg); }
.demo-user-body {
  padding: 0 0.95rem 0.95rem;
  border-top: 1px solid var(--line);
}
.demo-user-hint {
  margin: 0.75rem 0 0.65rem;
  font-size: 0.82rem;
}
.demo-user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.demo-user-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.7);
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  font: inherit;
  display: grid;
  gap: 0.15rem;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.demo-user-card:hover {
  transform: translateY(-1px);
  border-color: rgba(11,110,106,0.35);
  box-shadow: 0 10px 22px rgba(15,28,46,0.08);
}
.demo-user-card span { font-size: 0.82rem; color: var(--ocean-deep); font-weight: 650; }
.demo-user-card em { color: var(--ink); font-size: 0.74rem; font-style: normal; line-height: 1.35; }
.demo-user-card small { color: var(--ink-soft); font-size: 0.72rem; line-height: 1.3; }

.auth-stage-wide { grid-template-columns: 1.05fr 0.95fr; }
.auth-panel-scroll {
  place-items: center;
  overflow-y: auto;
  max-height: 100vh;
  padding: 2rem;
}

.toast-host {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 2000;
  display: grid;
  gap: 0.45rem;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 420px;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #162636;
  color: #fff;
  box-shadow: 0 14px 30px rgba(0,0,0,0.28);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  font-size: 0.88rem;
  font-weight: 650;
  pointer-events: auto;
  line-height: 1.4;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 4px solid #1aa39b; }
.toast-error { border-left: 4px solid #b34452; background: #3a1820; }
.toast-warning { border-left: 4px solid #d4892a; background: #3a2a14; }
.toast-info { border-left: 4px solid #2f8f9e; }

/* Shared confirmation dialog (activate/deactivate, approve/reject, etc.) */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.confirm-dialog[hidden] { display: none !important; }
.confirm-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 34, 0.55);
  backdrop-filter: blur(2px);
}
.confirm-dialog-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.35rem 1.35rem 1.15rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.1);
  box-shadow: 0 24px 48px rgba(10, 22, 34, 0.28);
  text-align: center;
  animation: rise 180ms ease;
}
.confirm-dialog-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #7a4010;
  background: rgba(196, 107, 26, 0.14);
  border: 1px solid rgba(196, 107, 26, 0.28);
}
.confirm-dialog[data-tone="error"] .confirm-dialog-icon {
  color: #6f2030;
  background: rgba(163, 59, 74, 0.12);
  border-color: rgba(163, 59, 74, 0.28);
}
.confirm-dialog[data-tone="primary"] .confirm-dialog-icon,
.confirm-dialog[data-tone="success"] .confirm-dialog-icon {
  color: #065a56;
  background: rgba(10, 124, 118, 0.12);
  border-color: rgba(10, 124, 118, 0.28);
}
.confirm-dialog-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--ink);
}
.confirm-dialog-body {
  margin: 0 0 1.15rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
body.confirm-open { overflow: hidden; }

/* Shared action modal (list / create actions) */
.action-modal {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.action-modal[hidden] { display: none !important; }
.action-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 34, 0.55);
  backdrop-filter: blur(2px);
}
.action-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.1);
  box-shadow: 0 24px 48px rgba(10, 22, 34, 0.28);
  animation: rise 180ms ease;
}
.action-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.action-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}
.action-modal-close { flex-shrink: 0; }
.action-modal-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  min-height: 0;
}
.action-modal-body .form-grid,
.action-modal-body .stack-sm { gap: 1.05rem 1.2rem; }
.action-modal-body .form-actions { display: none; }
.action-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.15rem 1.1rem;
  border-top: 1px solid var(--line);
}
form.action-modal-source[hidden] { display: none !important; }
body.action-modal-open { overflow: hidden; }

/* In-page document preview (banking desk View) */
.doc-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 3150;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.doc-preview-modal[hidden] { display: none !important; }
.doc-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 34, 0.58);
  backdrop-filter: blur(2px);
}
.doc-preview-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.12);
  box-shadow: 0 28px 56px rgba(10, 22, 34, 0.32);
  animation: rise 160ms ease;
  overflow: hidden;
}
.doc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.doc-preview-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-preview-head-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.doc-preview-body {
  flex: 1;
  min-height: 0;
  background: #f3f5f7;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.doc-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.doc-preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
  padding: 1rem;
}
.doc-preview-fallback {
  margin: auto;
  padding: 2rem 1.5rem;
  text-align: center;
  max-width: 28rem;
}
body.doc-preview-open { overflow: hidden; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.pagination-meta { margin: 0; }
.pagination-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pagination-current {
  padding: 0 0.55rem;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.pagination-links .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.form-feedback {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.4;
}
.form-feedback-error {
  background: rgba(163, 59, 74, 0.12);
  color: #8a2a36;
  border: 1px solid rgba(163, 59, 74, 0.28);
}
.form-feedback-success {
  background: rgba(11, 110, 106, 0.12);
  color: #085652;
  border: 1px solid rgba(11, 110, 106, 0.28);
}
.form-feedback[hidden] { display: none !important; }

.mt-1 { margin-top: 1.15rem; }
.status-pending { background: #fde8cc; color: #8a3d05; border-color: #e3a45a; font-weight: 850; }
.status-completed { background: #d4f3e8; color: #065a45; border-color: #6fbfa0; }

.meta-row,
.party-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(12, 26, 40, 0.08);
  background: rgba(255, 255, 255, 0.72);
}
.meta-row .status-badge,
.party-row .status-badge {
  flex-shrink: 0;
}

/* Application detail workspace */
.app-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1.1rem;
  align-items: start;
}
.app-detail-layout-full,
.app-detail-layout:not(:has(> .app-detail-aside)) {
  grid-template-columns: minmax(0, 1fr);
}
.app-detail-main {
  min-width: 0;
  display: grid;
  gap: 1.15rem;
}
.app-detail-aside { min-width: 0; }
.facility-summary { margin-bottom: 0; }
.facility-grid { gap: 0.65rem 1rem; }
.section-subtitle {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.workspace-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
}
.workspace-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}
.workspace-chip {
  border: 1px solid var(--line);
  background: rgba(255,252,247,0.9);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.workspace-chip:hover {
  border-color: rgba(11,110,106,0.35);
  color: var(--ocean-deep);
}
.workspace-chip.is-active {
  background: rgba(11,110,106,0.12);
  border-color: rgba(11,110,106,0.4);
  color: var(--ocean-deep);
}

.accordion {
  display: grid;
  gap: 0.75rem;
}
.acc-item {
  overflow: hidden;
  padding: 0;
}
.acc-item.is-open {
  overflow: visible;
}
.acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
}
.acc-trigger strong {
  display: block;
  font-size: 1rem;
}
.acc-trigger small {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
}
.acc-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.acc-caret {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 8px;
  background: rgba(15,28,46,0.06);
  transition: transform 180ms ease;
}
.acc-item.is-open .acc-caret { transform: rotate(180deg); }
.acc-item.is-open {
  overflow: visible;
  border-color: rgba(11,110,106,0.28);
  box-shadow: 0 10px 28px rgba(15,28,46,0.06);
}
.acc-panel {
  padding: 1rem 1.15rem 1.35rem;
  border-top: 1px solid var(--line);
  animation: authRise 280ms ease both;
  display: grid;
  gap: 1.1rem;
  overflow: visible;
  min-width: 0;
}
.acc-panel[hidden] { display: none !important; }

.history-drawer {
  overflow: hidden;
}
.history-drawer-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  font: inherit;
}
.history-drawer-summary::-webkit-details-marker { display: none; }
.history-drawer-body { padding-top: 0; border-top: 1px solid var(--line); }

/* Sticky officer rail: stay in view and scroll when workflow + history overflow */
.app-detail-aside {
  position: sticky;
  top: 5.1rem;
  align-self: start;
  z-index: 25;
  max-height: calc(100vh - 5.4rem);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.officer-rail-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
}
.officer-rail-shell > .officer-rail,
.officer-rail-shell > .next-due-card {
  flex: 0 0 auto;
}
.officer-rail {
  max-height: none;
  overflow: visible;
}
/* Workflow + history: shell scrolls as one column (do not clip management stage). */
.officer-rail-shell > .officer-rail {
  max-height: none;
  overflow: visible;
}
.officer-rail-shell:has(> .history-panel) > .officer-rail {
  max-height: none;
  overflow: visible;
  flex: 0 0 auto;
}
.officer-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.history-panel {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  margin: 0;
}
.history-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.05rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.history-panel-head strong {
  font-size: 0.95rem;
  font-weight: 750;
}
.history-panel-scroll {
  flex: 0 1 auto;
  max-height: 16rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1.05rem 1.05rem;
  scrollbar-width: thin;
}
.history-panel-scroll .timeline {
  margin: 0;
}
.history-panel-scroll .timeline-item + .timeline-item {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(15, 28, 46, 0.1);
}

.role-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.1rem 0 1.4rem;
}
.role-perm-section {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}
.role-perm-legend {
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.role-perm-children {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.role-perm-children .checkbox-row {
  min-height: 1.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .app-detail-layout { grid-template-columns: 1fr; }
  .app-detail-aside {
    position: static;
    max-height: none;
  }
  .officer-rail-shell {
    max-height: none;
    overflow: visible;
  }
  .officer-rail,
  .officer-rail-shell > .officer-rail,
  .officer-rail-shell:has(> .history-panel) > .officer-rail {
    max-height: none;
    overflow: visible;
  }
  .history-panel {
    min-height: 0;
  }
  .history-panel-scroll {
    max-height: 22rem;
  }
  .sticky-panel { position: static; }
}


@media (max-width: 900px) {
  .flow-track-window { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .demo-user-grid { grid-template-columns: 1fr; }
  .pipeline-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
  .flow-track-window { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== Icons (mask-based) ===== */
.ui-icon {
  width: 1.1rem;
  height: 1.1rem;
  display: inline-block;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  vertical-align: middle;
}
.ui-icon-search {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath stroke-linecap='round' d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}
.ui-icon-refresh {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4 4v6h6M20 20v-6h-6'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M20.49 9A9 9 0 005.64 5.64L4 8m16 8l-1.64 2.36A9 9 0 013.51 15'/%3E%3C/svg%3E");
}
.ui-icon-plus {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.4'%3E%3Cpath stroke-linecap='round' d='M12 5v14M5 12h14'/%3E%3C/svg%3E");
}
.ui-icon-save {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 21H7a2 2 0 01-2-2V5a2 2 0 012-2h8l4 4v12a2 2 0 01-2 2z'/%3E%3Cpath stroke-linecap='round' d='M9 21v-8h6v8M9 3v5h5'/%3E%3C/svg%3E");
}
.ui-icon-x {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.4'%3E%3Cpath stroke-linecap='round' d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}
.ui-icon-edit {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4 12.5-12.5z'/%3E%3C/svg%3E");
}
.ui-icon-bell {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2c0 .5-.2 1-.6 1.4L4 17h5m6 0a3 3 0 11-6 0'/%3E%3C/svg%3E");
}
.ui-icon-user {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath stroke-linecap='round' d='M5 19.5c1.5-3.2 3.9-4.8 7-4.8s5.5 1.6 7 4.8'/%3E%3C/svg%3E");
}
.ui-icon-users {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath stroke-linecap='round' d='M3.5 19c1.2-2.8 3.2-4.2 5.5-4.2S13.3 16.2 14.5 19M14 14.8c1.5-.4 2.9.1 4 1.5.8 1.1 1.2 2 1.5 2.7'/%3E%3C/svg%3E");
}
.ui-icon-check {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.4'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
}
.ui-icon-arrow-left {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 12H5M11 6l-6 6 6 6'/%3E%3C/svg%3E");
}
.ui-icon-arrow-right {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
}
.ui-icon-chevrons {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 6l6 6-6 6'/%3E%3C/svg%3E");
}
.ui-icon-filter {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4 5h16l-6 7v5l-4 2v-7L4 5z'/%3E%3C/svg%3E");
}
.ui-icon-shield {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 3l8 3v6c0 5-3.5 8.5-8 9.5C7.5 20.5 4 17 4 12V6l8-3z'/%3E%3C/svg%3E");
}
.ui-icon-file {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 3h6l5 5v12a1 1 0 01-1 1H8a1 1 0 01-1-1V4a1 1 0 011-1z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E");
}
.ui-icon-home {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4 11l8-7 8 7v9a1 1 0 01-1 1h-5v-6H10v6H5a1 1 0 01-1-1v-9z'/%3E%3C/svg%3E");
}
.ui-icon-key {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath stroke-linecap='round' d='M11 13l9-9M16 4l3 3'/%3E%3C/svg%3E");
}
.ui-icon-logout {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10 7V6a2 2 0 012-2h7v16h-7a2 2 0 01-2-2v-1M15 12H4m0 0l3-3m-3 3l3 3'/%3E%3C/svg%3E");
}
.ui-icon-spark {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 3l1.6 5.2L19 10l-5.4 1.8L12 17l-1.6-5.2L5 10l5.4-1.8L12 3zM19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z'/%3E%3C/svg%3E");
}
.ui-icon-external {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M14 4h6v6M20 4l-8.5 8.5'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M18 14v5a1 1 0 01-1 1H5a1 1 0 01-1-1V7a1 1 0 011-1h5'/%3E%3C/svg%3E");
}
.ui-icon-print {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M7 9V4h10v5M7 18H5a1 1 0 01-1-1v-6a1 1 0 011-1h14a1 1 0 011 1v6a1 1 0 01-1 1h-2'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M7 14h10v6H7z'/%3E%3C/svg%3E");
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Rich search / toolbar ===== */
.page-toolbar,
.page-toolbar-rich {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,252,247,0.92), rgba(255,255,255,0.72));
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(15, 28, 46, 0.06);
}

.filter-bar,
.filter-bar-rich {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 0;
  flex: 1 1 320px;
  min-width: min(100%, 280px);
}
.filter-bar .form-field { margin-bottom: 0; min-width: 160px; }
.search-field { min-width: 220px; flex: 1; }

.search-shell {
  position: relative;
  flex: 1 1 260px;
  min-width: min(100%, 220px);
  display: flex;
  align-items: center;
  height: 2.85rem;
}
.search-shell-leading {
  position: absolute;
  left: 0.9rem;
  color: var(--ocean);
  opacity: 0.75;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.search-shell .search-input,
.search-shell input[type="search"] {
  padding-left: 2.55rem !important;
  padding-right: 2.4rem !important;
  height: 2.85rem;
  min-height: 2.85rem;
  width: 100%;
  box-sizing: border-box;
  border-radius: 14px !important;
  background: #fff !important;
  border: 1px solid rgba(15, 28, 46, 0.12) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 2px rgba(15,28,46,0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-shell .search-input:focus {
  border-color: var(--ocean) !important;
  box-shadow: 0 0 0 3px rgba(11, 110, 106, 0.16);
}
.search-shell-clear {
  position: absolute;
  right: 0.55rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(15, 28, 46, 0.06);
  transition: background 140ms ease, color 140ms ease;
}
.search-shell-clear:hover {
  background: rgba(163, 59, 74, 0.12);
  color: var(--rose);
}
.search-shell input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.filter-actions .btn {
  height: 2.85rem;
  padding-inline: 0.95rem;
}
.filter-actions .btn .ui-icon {
  width: 1rem;
  height: 1rem;
}

.filter-bar .filter-select,
.filter-bar-rich .filter-select {
  height: 2.85rem;
  min-width: 11rem;
  border-radius: 14px;
  background: #fff;
}

.bucket-chip-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
}
.bucket-chip-bar .btn {
  height: 2.5rem;
}

.page-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.page-toolbar-actions .btn {
  height: 2.85rem;
}

.panel-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.panel-section-toolbar .section-title {
  margin: 0;
}

/* ===== Tom Select / autocomplete ===== */
select.tomselected,
select.ts-hidden-accessible,
.form-field select.tomselected,
.form-field select.ts-hidden-accessible {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  pointer-events: none !important;
}
.ts-wrapper {
  width: 100%;
}
.ts-wrapper + select.tomselected,
.ts-wrapper select.tomselected {
  display: none !important;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  min-height: 2.85rem;
  border-radius: 14px !important;
  border: 1px solid rgba(15, 28, 46, 0.12) !important;
  background: #fff !important;
  color: var(--ink) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 2px rgba(15,28,46,0.04);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.45rem 2.35rem 0.45rem 0.85rem !important;
}
/* Single-select: one compact row like a normal field (no tag chip / no second line) */
.ts-wrapper.single .ts-control {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  height: 2.85rem;
  max-height: 2.85rem;
  overflow: hidden;
}
.ts-wrapper.single .ts-control .item,
.ts-wrapper.single .ts-control .ts-item-single {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink) !important;
}
.ts-wrapper.single .ts-control > input {
  color: #0c1a28 !important;
  -webkit-text-fill-color: #0c1a28 !important;
  min-width: 2px !important;
  flex: 1 1 auto;
}
.ts-wrapper .ts-control input::placeholder,
.ts-wrapper.single .ts-control > input::placeholder {
  color: #8a9aac !important;
  -webkit-text-fill-color: #8a9aac !important;
  opacity: 1 !important;
  font-weight: 400 !important;
}
.ts-wrapper.single.has-items .ts-control > input {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  opacity: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  position: absolute !important;
}
/* While searching: show only the typed query — hide selected chip / "Select" text. */
.ts-wrapper.single.dropdown-active.input-active .ts-control .item,
.ts-wrapper.single.dropdown-active.input-active .ts-control .ts-item-single {
  display: none !important;
}
.ts-wrapper.single.dropdown-active.input-active .ts-control > input,
.ts-wrapper.single.has-items.focus:not(.dropdown-active) .ts-control > input,
.ts-wrapper.single.has-items.input-active .ts-control > input {
  position: static !important;
  opacity: 1 !important;
  width: 100% !important;
  min-width: 3.5rem !important;
  max-width: none !important;
  flex: 1 1 auto !important;
}
.ts-dropdown .option[data-value=""],
.ts-dropdown .option:empty {
  display: none !important;
}
.ts-wrapper.single .clear-button {
  right: 1.85rem;
  margin-top: 0;
  opacity: 0.55;
}
.ts-wrapper.single .clear-button:hover { opacity: 1; }
.ts-wrapper .ts-control > * {
  color: var(--ink) !important;
}
.ts-wrapper.focus .ts-control {
  border-color: var(--ocean) !important;
  box-shadow: 0 0 0 2px rgba(11, 110, 106, 0.12) !important;
}
/* Must sit above action modal (3100) and confirm dialog */
.ts-dropdown {
  border-radius: 14px !important;
  border: 1px solid rgba(15, 28, 46, 0.14) !important;
  background: #fff !important;
  color: var(--ink) !important;
  box-shadow: 0 18px 44px rgba(15, 28, 46, 0.18) !important;
  z-index: 5200 !important;
  overflow: hidden;
}
.ts-dropdown .ts-dropdown-content {
  max-height: 16rem;
  padding: 0.3rem;
  background: #fff !important;
}
.ts-dropdown .option,
.ts-dropdown .optgroup-header,
.ts-dropdown .no-results,
.ts-dropdown .create {
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  color: #0c1a28 !important;
  background: #fff !important;
  font-size: 0.92rem;
  font-weight: 550;
  line-height: 1.35;
}
.ts-dropdown .option .ts-option-label {
  color: #0c1a28 !important;
}
.ts-dropdown .option.active,
.ts-dropdown .option:hover,
.ts-dropdown .option.selected {
  background: rgba(11, 110, 106, 0.14) !important;
  color: #0c1a28 !important;
}
.ts-search-hint {
  margin: 0;
  padding: 0.55rem 0.75rem 0.65rem;
  border-top: 1px solid rgba(15, 28, 46, 0.1);
  background: #f4f8f9;
  color: #243746 !important;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}
.form-field .helptext,
.form-field .help-text,
.helptext {
  color: #2a3f52 !important;
  font-size: 0.84rem;
  line-height: 1.45;
  opacity: 1;
}
.form-field .ts-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}
.filter-bar .ts-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: min(100%, 12rem);
  flex: 1 1 12rem;
}
.filter-bar .form-field {
  flex: 0 1 12rem;
  min-width: 10rem;
}
.filter-bar .filter-select {
  width: 100%;
  min-width: 10rem;
}
.filter-bar .ts-wrapper.single .ts-control {
  min-height: 2.85rem;
}
body.action-modal-open .ts-dropdown,
body.confirm-open .ts-dropdown {
  z-index: 5300 !important;
}

/* ===== Topbar / main chrome ===== */
.main {
  background:
    radial-gradient(760px 320px at 92% -8%, rgba(10,124,118,0.1), transparent 55%),
    radial-gradient(520px 280px at 0% 100%, rgba(27,127,146,0.07), transparent 50%),
    transparent;
}
.topbar {
  position: sticky;
  top: 0.35rem;
  z-index: 100;
  margin-bottom: 1rem;
  border-bottom: 0;
}
.topbar h1 {
  background: linear-gradient(120deg, var(--ink) 18%, var(--ocean-deep) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.pill {
  box-shadow: 0 4px 14px rgba(13, 27, 42, 0.05);
}
.pill .ui-icon { width: 0.9rem; height: 0.9rem; opacity: 0.85; }

.page-body {
  display: grid;
  gap: 1.2rem;
}

/* ===== Tables / empty / pagination ===== */
.data-table thead th {
  /* Default: not sticky — sticky+collapse caused header/data overlap app-wide */
  position: static;
  z-index: auto;
  background: #e8f3f3;
}
.table-scroll .data-table thead th,
.table-wrap.is-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #e8f3f3;
  box-shadow: 0 1px 0 rgba(12, 26, 40, 0.12);
}
.data-table tbody tr {
  transition: background 160ms ease;
}
.data-table tbody tr:hover {
  background: rgba(11, 110, 106, 0.06);
}
.empty-state {
  text-align: center;
  padding: 2rem 1rem !important;
  color: var(--ink-soft);
  font-weight: 550;
}
.pagination-bar {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pagination-links .btn {
  gap: 0.3rem;
}

/* ===== Cards / portal ===== */
.stat-card {
  transition: transform 220ms var(--ease-out), box-shadow 220ms ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.menu-card,
.module-card,
.portal-card {
  position: relative;
  overflow: hidden;
}
.menu-card::after,
.module-card::after,
.portal-card::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  background: var(--ocean);
  opacity: 0.35;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23000' stroke-width='2.3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: opacity 160ms ease, transform 160ms ease;
}
.menu-card:hover::after,
.module-card:hover::after,
.portal-card:hover::after {
  opacity: 0.85;
  transform: translate(3px, -50%);
}

.portal-hero {
  background:
    radial-gradient(600px 220px at 100% 0%, rgba(11,110,106,0.16), transparent 55%),
    radial-gradient(420px 180px at 0% 100%, rgba(196,107,26,0.12), transparent 50%),
    var(--surface);
  overflow: hidden;
}
.portal-hero .section-title {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}
.portal-hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.portal-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(11,110,106,0.1);
  color: var(--ocean-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title .ui-icon {
  color: var(--ocean);
  width: 1.15rem;
  height: 1.15rem;
}

/* ===== Sidebar polish ===== */
.sidebar {
  background:
    radial-gradient(480px 240px at 0% 0%, rgba(26,163,155,0.22), transparent 55%),
    linear-gradient(180deg, #12253a 0%, #0c1828 55%, #0a1420 100%);
}
.nav-list a.is-active .nav-icon,
.nav-link.is-active .nav-icon,
.nav-group.is-open > .nav-parent .nav-icon {
  background: rgba(26, 163, 155, 0.28);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.nav-sub-link {
  position: relative;
  padding-left: 1.1rem !important;
}
.nav-sub-link::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  transform: translateY(-50%);
}

/* ===== Form controls polish ===== */
.field-control,
.form-field select,
.form-field textarea,
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field input[type="search"] {
  border-radius: 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.form-actions .btn { min-width: 7.5rem; }

@media (max-width: 900px) {
  .page-toolbar,
  .page-toolbar-rich {
    padding: 0.75rem;
  }
  .filter-actions,
  .page-toolbar-actions {
    width: 100%;
  }
  .filter-actions .btn,
  .page-toolbar-actions .btn {
    flex: 1 1 auto;
  }
}

/* ===== Motion / wow polish ===== */
.main {
  position: relative;
  isolation: isolate;
}
.main::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  animation: orbFloat 12s ease-in-out infinite;
  width: 240px;
  height: 240px;
  bottom: 10%;
  left: 6%;
  background: rgba(214, 140, 52, 0.22);
  animation-delay: -4s;
}
.main > * { position: relative; z-index: 1; }
.main > .topbar { z-index: 100; }
.main > .page-body { z-index: 1; }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  bottom: auto;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid rgba(15, 28, 46, 0.12);
  border-radius: 14px;
  padding: 0.45rem;
  box-shadow: 0 22px 48px rgba(15, 28, 46, 0.18);
  z-index: 300;
  display: grid;
  gap: 0.2rem;
  color: #0f1c2e;
  isolation: isolate;
  overflow: hidden;
}
.profile-dropdown[hidden] { display: none !important; }
.profile-dropdown a,
.profile-dropdown a:visited,
.profile-dropdown button,
.profile-dropdown .profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: #ffffff;
  color: #0f1c2e !important;
  -webkit-text-fill-color: #0f1c2e !important;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  opacity: 1 !important;
  text-decoration: none !important;
  position: relative;
  z-index: 1;
}
.profile-dropdown .ui-icon {
  width: 1.05rem;
  height: 1.05rem;
  opacity: 1 !important;
  color: #085652 !important;
  -webkit-text-fill-color: #085652 !important;
  background: #085652 !important;
  flex-shrink: 0;
}
.profile-dropdown a:hover,
.profile-dropdown a:focus-visible,
.profile-dropdown button:hover,
.profile-dropdown button:focus-visible,
.profile-dropdown .profile-dropdown-item:hover,
.profile-dropdown .profile-dropdown-item:focus-visible {
  background: #eef7f6 !important;
  color: #085652 !important;
  -webkit-text-fill-color: #085652 !important;
}

@keyframes orbFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(12px, -18px, 0) scale(1.08); }
}

.stat-card {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition:
    opacity 560ms var(--ease-out),
    transform 560ms var(--ease-out),
    box-shadow 220ms ease;
  transition-delay: var(--stagger, 0ms);
}
.stat-card.is-inview {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(125deg, transparent 30%, rgba(255,255,255,0.45) 48%, transparent 62%);
  transform: translateX(-120%);
  pointer-events: none;
}
.stat-card.is-inview::before {
  animation: sheen 1.4s var(--ease-out) 0.35s both;
}
@keyframes sheen {
  to { transform: translateX(120%); }
}

.stat-value {
  position: relative;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  transition: transform 280ms var(--ease-out), text-shadow 280ms ease;
}
.stat-value.is-popped {
  animation: numberPop 520ms var(--ease-out);
}
@keyframes numberPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); text-shadow: 0 8px 24px rgba(11,110,106,0.22); }
  100% { transform: scale(1); }
}

.chart-panel {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 520ms var(--ease-out),
    transform 520ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    border-color 220ms var(--ease-out);
  transition-delay: var(--stagger, 0ms);
  will-change: opacity, transform;
}
.chart-panel.is-inview {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}
.chart-panel.has-chart:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(12, 26, 40, 0.1);
}
.chart-panel .chart-wrap {
  position: relative;
  animation: chartReveal 640ms var(--ease-out) both;
  animation-delay: 0.12s;
}
.chart-panel .chart-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 0 0 rgba(10, 124, 118, 0);
  transition: box-shadow 220ms var(--ease-out);
}
.chart-panel.has-chart:hover .chart-wrap::after {
  box-shadow: inset 0 0 0 1px rgba(10, 124, 118, 0.16);
}
@keyframes chartReveal {
  from { opacity: 0.25; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes chartPulseIn {
  from { opacity: 0.35; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.bar {
  position: relative;
  overflow: hidden;
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(15, 28, 46, 0.08);
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ocean), var(--teal), var(--amber));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(11, 110, 106, 0.35);
  animation: barShine 2.8s linear infinite;
}
@keyframes barShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.module-card,
.menu-card,
.portal-card {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 520ms var(--ease-out),
    transform 520ms var(--ease-out),
    box-shadow 200ms ease,
    border-color 200ms ease;
  transition-delay: var(--stagger, 0ms);
}
.module-card.is-inview,
.menu-card.is-inview,
.portal-card.is-inview {
  opacity: 1;
  transform: translateY(0);
}

.topbar h1 {
  animation: titleGlow 4.5s ease-in-out infinite;
}
@keyframes titleGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.08); }
}

.pill-soft {
  animation: pillBreath 3.2s ease-in-out infinite;
}
@keyframes pillBreath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(11,110,106,0.0); }
  50% { box-shadow: 0 0 0 4px rgba(11,110,106,0.08); }
}

.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255,255,255,0.28) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: none;
}
.btn-primary:hover::after {
  animation: btnSheen 700ms var(--ease-out);
}
@keyframes btnSheen {
  to { transform: translateX(120%); }
}

.stat-grid .stat-card:nth-child(1) { --stagger: 0ms; }
.stat-grid .stat-card:nth-child(2) { --stagger: 70ms; }
.stat-grid .stat-card:nth-child(3) { --stagger: 140ms; }
.stat-grid .stat-card:nth-child(4) { --stagger: 210ms; }

.pipeline-row strong {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .main::before,
  .main::after,
  .stat-card::before,
  .bar > span,
  .topbar h1,
  .pill-soft,
  .btn-primary::after,
  .chart-panel .chart-wrap {
    animation: none !important;
  }
  .stat-card,
  .chart-panel,
  .module-card,
  .menu-card,
  .portal-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===== Master row actions + toggle switches ===== */
.row-actions {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }
.btn-status-on {
  background: rgba(11, 110, 106, 0.12);
  color: var(--ocean-deep);
  border: 1px solid rgba(11, 110, 106, 0.22);
}
.btn-status-on:hover { background: rgba(11, 110, 106, 0.2); }
.btn-status-off {
  background: rgba(15, 28, 46, 0.05);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-status-off:hover {
  background: rgba(163, 59, 74, 0.1);
  color: var(--rose);
  border-color: rgba(163, 59, 74, 0.25);
}

.form-toggles:not(:has(.toggle-field)) {
  display: none;
}
.form-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 1.15rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(11, 110, 106, 0.05), rgba(255, 255, 255, 0.7));
}
.toggle-field {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 28, 46, 0.08);
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.toggle-field:hover {
  border-color: rgba(11, 110, 106, 0.28);
  box-shadow: 0 8px 20px rgba(15, 28, 46, 0.06);
}
.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 28px;
  margin-top: 0.1rem;
}
.toggle-switch input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(15, 28, 46, 0.18);
  transition: background 180ms ease;
  box-shadow: inset 0 1px 2px rgba(15, 28, 46, 0.12);
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 28, 46, 0.22);
  transition: transform 180ms var(--ease-out, ease);
}
.toggle-switch input[type="checkbox"]:checked + .toggle-track {
  background: linear-gradient(135deg, var(--ocean), var(--ocean-deep));
}
.toggle-switch input[type="checkbox"]:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-track {
  outline: 2px solid rgba(11, 110, 106, 0.35);
  outline-offset: 2px;
}
.toggle-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.toggle-copy strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
.toggle-copy small {
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Role permission checkboxes also as compact toggles */
.role-perm-section .checkbox-row input[type="checkbox"],
.role-perm-children .checkbox-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--ocean);
}

/* ===== LAMS officer detail readability ===== */
.lams-detail-toolbar { align-items: flex-start; }
.lams-identity { min-width: 0; }
.lams-identity-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.7rem;
  margin-bottom: 0.35rem;
}
.lams-account-no {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ocean-deep);
  line-height: 1.15;
}
.lams-identity-meta {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
}
.lams-identity-meta strong { color: var(--ink); font-weight: 700; }

/* Facility journey trail (Lead → CIF → App → Account → 360) */
.facility-journey {
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(11, 110, 106, 0.04), rgba(255, 255, 255, 0.9));
}
.facility-journey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}
.facility-journey-step {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.facility-journey-step:not(:last-child)::after {
  content: "›";
  margin: 0 0.4rem 0 0.55rem;
  color: var(--line-strong, #9aa7b2);
  font-weight: 500;
}
.facility-journey-step a {
  color: var(--ocean-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.facility-journey-step a:hover {
  border-bottom-color: rgba(11, 110, 106, 0.35);
}
.facility-journey-step.is-current {
  color: var(--ocean-deep);
}
.facility-journey-step.is-current a,
.facility-journey-step.is-current > span {
  font-weight: 750;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(11, 110, 106, 0.12);
}
.facility-journey-step.is-muted > span {
  opacity: 0.55;
  font-weight: 500;
}

.attn-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.attn-critical { background: rgba(163, 59, 74, 0.14); color: #7d2a36; }
.attn-watch { background: rgba(196, 107, 26, 0.16); color: #8a4a10; }

.attn-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.attn-critical.attn-strip,
.attn-strip.attn-critical {
  background: linear-gradient(135deg, rgba(163, 59, 74, 0.1), rgba(255, 252, 247, 0.9));
  border-color: rgba(163, 59, 74, 0.28);
}
.attn-watch.attn-strip,
.attn-strip.attn-watch {
  background: linear-gradient(135deg, rgba(196, 107, 26, 0.1), rgba(255, 252, 247, 0.9));
  border-color: rgba(196, 107, 26, 0.28);
}
.attn-strip-main {
  display: grid;
  gap: 0.2rem;
  min-width: min(100%, 280px);
}
.attn-strip-main strong { font-size: 0.98rem; color: var(--ink); }
.attn-strip-main span { color: var(--ink-soft); font-size: 0.86rem; }
.attn-strip-flags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.attn-strip-flags li {
  display: grid;
  gap: 0.1rem;
  min-width: 5.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 28, 46, 0.06);
}
.attn-flag-label {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.attn-strip-flags strong {
  font-size: 0.95rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.lams-kpi-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.lams-kpi {
  position: relative;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.lams-kpi.is-primary {
  background:
    linear-gradient(145deg, rgba(11, 110, 106, 0.12), rgba(31, 122, 140, 0.05)),
    var(--surface);
  border-color: rgba(11, 110, 106, 0.28);
  box-shadow: 0 12px 28px rgba(15, 28, 46, 0.06);
}
.lams-kpi.is-alert {
  border-color: rgba(163, 59, 74, 0.28);
  background: linear-gradient(145deg, rgba(163, 59, 74, 0.08), var(--surface));
}
.lams-kpi-label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lams-kpi-value {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  font-weight: 700;
  color: var(--ocean-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.lams-kpi.is-primary .lams-kpi-value { font-size: clamp(1.45rem, 2.2vw, 1.85rem); }
.lams-kpi.is-alert .lams-kpi-value { color: #7d2a36; }
.lams-kpi-unit {
  font-size: 0.72em;
  font-weight: 600;
  color: var(--ink-soft);
}
.lams-kpi-hint {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.workspace-nav-sticky {
  position: sticky;
  top: 4.6rem;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  margin: 0 -0.15rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 28, 46, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 22px rgba(12, 26, 40, 0.06);
}
.workspace-chip.has-alert {
  border-color: rgba(196, 107, 26, 0.45);
  color: #8a4a10;
  background: rgba(196, 107, 26, 0.1);
}

.officer-rail .section-title { margin-bottom: 0.85rem; }
.officer-focus-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(11, 110, 106, 0.12), rgba(31, 122, 140, 0.06));
  border: 1px solid rgba(11, 110, 106, 0.2);
}
.officer-focus-metric span {
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.officer-focus-metric strong {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--ocean-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
  max-width: 100%;
}
.officer-facts {
  display: grid;
  gap: 0.15rem;
  margin: 0;
}
.officer-facts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed rgba(15, 28, 46, 0.08);
}
.officer-facts > div:last-child { border-bottom: 0; padding-bottom: 0; }
.officer-facts dt {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 650;
}
.officer-facts dd {
  margin: 0;
  text-align: right;
  font-size: 0.92rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.btn-block { width: 100%; justify-content: center; }
.next-due-card {
  background: linear-gradient(160deg, rgba(196, 107, 26, 0.08), var(--surface));
  border-color: rgba(196, 107, 26, 0.22);
}
.next-due-id {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ocean-deep);
}

.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.callout > div { display: grid; gap: 0.15rem; }
.callout strong { font-size: 0.95rem; }
.callout span { color: var(--ink-soft); font-size: 0.86rem; }
.callout-amber {
  background: rgba(196, 107, 26, 0.08);
  border-color: rgba(196, 107, 26, 0.28);
}
.callout-danger {
  background: rgba(163, 59, 74, 0.08);
  border-color: rgba(163, 59, 74, 0.28);
  display: grid;
  gap: 0.2rem;
}

.tranche-card,
.recovery-card,
.action-block,
.info-tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 28, 46, 0.02);
  padding: 1.1rem 1.15rem;
  margin-bottom: 1rem;
}
.action-block {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.action-block > .section-subtitle {
  margin-bottom: 0;
}
.action-block > .form-grid,
.action-block > .inline-actions,
.action-block > .table-wrap,
.action-block > .stack-sm,
.action-block > .filter-bar {
  margin: 0;
}
.action-block .form-actions {
  margin-top: 0.15rem;
  padding-top: 0.95rem;
}
.tranche-card.is-planned {
  border-color: rgba(11, 110, 106, 0.28);
  background: rgba(11, 110, 106, 0.04);
}
.tranche-card-head,
.recovery-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.tranche-card-head > div:first-child,
.recovery-card-head > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tranche-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.tranche-disburse { margin-bottom: 0.65rem; }
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 28, 46, 0.06);
}
.checklist-item.is-open {
  border-color: rgba(196, 107, 26, 0.42);
  background: rgba(253, 232, 204, 0.45);
}
.checklist-item.is-done {
  border-color: rgba(11, 110, 106, 0.35);
  background: rgba(212, 243, 232, 0.5);
  opacity: 1;
}
.checklist-item em { color: #8a4a10; font-style: normal; font-weight: 800; }

/* Reviewable evidence checklist (lead / app / account desks) */
.review-checklist {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.review-check {
  border: 1px solid rgba(15, 28, 46, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.85rem 1rem 0.95rem;
  display: grid;
  gap: 0.7rem;
}
.review-check.is-open {
  border-color: rgba(196, 107, 26, 0.4);
  background: rgba(255, 248, 238, 0.92);
}
.review-check.is-done {
  border-color: rgba(11, 110, 106, 0.32);
  background: rgba(236, 250, 246, 0.92);
}
.review-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.review-check-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.review-check-caret {
  display: inline-flex;
  width: 1.1rem;
  justify-content: center;
  color: var(--ink-soft);
  transition: transform 160ms ease;
}
.review-check.is-expanded .review-check-caret {
  transform: rotate(180deg);
}
.review-check-body {
  display: grid;
  gap: 0.7rem;
}
.review-check-body[hidden] {
  display: none !important;
}
.review-check-summary {
  margin: 0;
  font-size: 0.82rem;
}
.review-check-title {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.review-check-title strong {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--ink);
}
.review-check-title .text-muted {
  margin: 0;
  font-size: 0.82rem;
}
.review-check-mark {
  color: #0b6e6a;
  font-style: normal;
  font-weight: 800;
  margin-right: 0.15rem;
}
.review-evidence {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}
.review-evidence-row {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: 0.55rem 0.85rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 28, 46, 0.05);
}
.review-evidence-row dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.review-evidence-row dd {
  margin: 0;
  font-size: 0.78rem;
  color: #0c1a28;
  overflow-wrap: break-word;
  word-break: normal;
}
.review-evidence-row.tone-ok {
  border-color: rgba(11, 110, 106, 0.22);
  background: rgba(212, 243, 232, 0.35);
}
.review-evidence-row.tone-warn {
  border-color: rgba(196, 107, 26, 0.28);
  background: rgba(253, 232, 204, 0.4);
}
.review-evidence-row.tone-missing {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(254, 226, 226, 0.45);
}
.review-docs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.review-doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(15, 28, 46, 0.08);
  background: #fff;
  font-size: 0.78rem;
}
.review-check-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(15, 28, 46, 0.1);
}
.review-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.review-toggle {
  margin: 0;
}
@media (max-width: 700px) {
  .review-evidence-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}
.condition-status:not(.status-badge) {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.info-tile {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0;
}
.info-tile.compact {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}
.info-tile.compact.is-pending {
  border-color: rgba(196, 107, 26, 0.35);
  background: rgba(196, 107, 26, 0.08);
}
.info-tile-value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ocean-deep);
  font-variant-numeric: tabular-nums;
}

.data-table-readable td,
.data-table-readable th {
  vertical-align: middle;
}
.data-table-readable .num,
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.num-emphasis {
  font-weight: 750;
  color: var(--ocean-deep);
}
.table-scroll {
  max-height: 22rem;
  overflow: auto;
}
.row-alert td { background: rgba(163, 59, 74, 0.07); }
.row-watch td { background: rgba(196, 107, 26, 0.06); }
.formula-cell {
  font-size: 0.8rem;
  max-width: 18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dpd-meter {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.dpd-meter-label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.dpd-meter-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: #7d2a36;
}
.dpd-meter-bar {
  width: min(160px, 40vw);
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 28, 46, 0.08);
  overflow: hidden;
}
.dpd-meter-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c46b1a, #a33b4a);
  border-radius: inherit;
}

/* LAMS/LOS status colours consolidated in base .status-* rules above */

.list-row-alert td { background: rgba(163, 59, 74, 0.06); }
.list-row-watch td { background: rgba(196, 107, 26, 0.05); }
.dpd-chip {
  display: inline-flex;
  min-width: 2.4rem;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  background: rgba(15, 28, 46, 0.06);
}
.dpd-chip.is-watch { background: rgba(196, 107, 26, 0.16); color: #8a4a10; }
.dpd-chip.is-critical { background: rgba(163, 59, 74, 0.14); color: #7d2a36; }

@media (max-width: 1100px) {
  .lams-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lams-kpi.is-primary { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .lams-kpi-grid { grid-template-columns: 1fr; }
  .workspace-nav-sticky { position: static; }
  .attn-strip { flex-direction: column; align-items: stretch; }
}

/* Stronger PASS/FAIL validation chips */
.status-pass,
.status-ok {
  background: #d4f3e8;
  color: #065a45;
  border-color: #6fbfa0;
}
.status-fail,
.status-failed,
.status-error {
  background: #fadce1;
  color: #8a1f32;
  border-color: #d98a98;
  font-weight: 850;
}
.status-dropped,
.status-lost {
  background: #fadce1;
  color: #8a1f32;
  border-color: #d98a98;
}
.status-waived {
  background: #ece7f5;
  color: #4a3a6b;
  border-color: #b5a6d4;
}

/* row action sizing handled in demo polish block */
.inline-actions .btn-secondary { background: linear-gradient(160deg, rgba(11,110,106,0.14), rgba(31,122,140,0.12)); }

/* ===== System surfaces v2 — page canvas, heroes, forms, lists ===== */
.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.2rem 1.35rem;
  border-radius: 20px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  background:
    linear-gradient(135deg, rgba(10, 124, 118, 0.14), rgba(27, 127, 146, 0.08) 48%, rgba(255,255,255,0.55)),
    rgba(255,255,255,0.55);
  box-shadow: 0 14px 34px rgba(13, 27, 42, 0.06);
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196,107,26,0.18), transparent 68%);
  pointer-events: none;
}
.page-hero-copy { position: relative; z-index: 1; max-width: 46rem; }
.page-hero-copy .eyebrow {
  margin: 0 0 0.35rem;
  color: var(--ocean-deep);
  font-weight: 800;
}
.page-hero-copy h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-hero-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.45;
}
.page-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.page-hero-los {
  background:
    linear-gradient(135deg, rgba(27, 127, 146, 0.16), rgba(10, 124, 118, 0.08) 50%, rgba(255,255,255,0.6)),
    rgba(255,255,255,0.55);
}
.page-hero-lams {
  background:
    linear-gradient(135deg, rgba(10, 124, 118, 0.16), rgba(196, 107, 26, 0.08) 55%, rgba(255,255,255,0.6)),
    rgba(255,255,255,0.55);
}
.page-hero-masters {
  background:
    linear-gradient(135deg, rgba(13, 27, 42, 0.08), rgba(10, 124, 118, 0.1) 55%, rgba(255,255,255,0.62)),
    rgba(255,255,255,0.55);
}
.page-hero-portal {
  background:
    linear-gradient(135deg, rgba(196, 107, 26, 0.12), rgba(10, 124, 118, 0.1) 55%, rgba(255,255,255,0.6)),
    rgba(255,255,255,0.55);
}

.page-toolbar-rich,
.page-toolbar {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(247,251,251,0.62));
  border: 1px solid rgba(13, 27, 42, 0.08);
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 10px 26px rgba(13, 27, 42, 0.04);
  backdrop-filter: blur(10px);
}

.form-shell {
  width: 100%;
  max-width: none;
}
.form-shell .panel,
.form-panel {
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
}
.form-shell .form-grid,
.form-panel .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.35rem;
}
.form-shell .form-grid.form-grid-dense,
.form-grid.form-grid-dense {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}
@media (min-width: 960px) {
  .form-shell .form-grid.form-grid-dense,
  .form-grid.form-grid-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .form-shell .form-grid:not(.form-grid-stack):not(.form-grid-dense),
  .form-panel .form-grid:not(.form-grid-stack):not(.form-grid-dense) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .form-shell .form-grid,
  .form-panel .form-grid,
  .form-grid.form-grid-dense {
    grid-template-columns: 1fr;
  }
}
/* Long fields always full row (notes / address / remarks) */
.form-shell .form-grid .form-field.span-2,
.form-panel .form-grid .form-field.span-2,
.form-grid .form-field.span-2,
.form-field:has(textarea) {
  grid-column: 1 / -1;
}
.field-control,
.form-field select,
.form-field textarea,
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field input[type="search"] {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(13, 27, 42, 0.12);
  box-shadow: inset 0 1px 2px rgba(13, 27, 42, 0.03);
}
.field-control:focus,
.form-field select:focus,
.form-field textarea:focus,
.form-field input:focus {
  border-color: rgba(10, 124, 118, 0.55);
  box-shadow: 0 0 0 4px rgba(10, 124, 118, 0.12);
  outline: none;
  background: #fff;
}

.table-wrap {
  border-radius: 14px;
  border: 1px solid rgba(13, 27, 42, 0.08);
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
}
.data-table {
  background: #fff;
}
.data-table thead th {
  background: #e8f3f3;
  color: #1f3548;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.data-table tbody tr:nth-child(even) td {
  background: rgba(10, 124, 118, 0.03);
}
.data-table tbody tr:hover td {
  background: rgba(10, 124, 118, 0.07);
}

.chart-panel,
.chart-wrap {
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(10,124,118,0.08), transparent 60%),
    transparent;
}
.module-card,
.menu-card {
  background:
    linear-gradient(160deg, rgba(255,255,255,0.9), rgba(247,251,251,0.72));
  border-color: rgba(13, 27, 42, 0.08);
}
.module-card:hover,
.menu-card:hover {
  background:
    linear-gradient(160deg, rgba(10, 124, 118, 0.1), rgba(255,255,255,0.88));
}

.messages {
  display: grid;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
}
.messages li {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 650;
  border: 1px solid transparent;
}
.messages .success,
.messages li.success {
  background: rgba(10, 124, 118, 0.12);
  color: #065a56;
  border-color: rgba(10, 124, 118, 0.28);
}
.messages .error,
.messages li.error {
  background: rgba(163, 59, 74, 0.12);
  color: #6f2030;
  border-color: rgba(163, 59, 74, 0.28);
}
.messages .warning,
.messages li.warning {
  background: rgba(196, 107, 26, 0.12);
  color: #7a4010;
  border-color: rgba(196, 107, 26, 0.28);
}
.messages .info,
.messages li.info {
  background: rgba(27, 127, 146, 0.12);
  color: #145968;
  border-color: rgba(27, 127, 146, 0.28);
}

.profile-trigger {
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(13, 27, 42, 0.08);
  box-shadow: 0 6px 16px rgba(13, 27, 42, 0.05);
}
.avatar {
  background: linear-gradient(135deg, var(--ocean), var(--teal));
  color: #fff;
}

.workspace-nav-sticky,
.workspace-nav {
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(13, 27, 42, 0.08);
}
.workspace-nav-actions .btn {
  white-space: nowrap;
}
.workspace-chip {
  background: rgba(255,255,255,0.9);
}
.workspace-chip.is-active {
  background: linear-gradient(135deg, rgba(10,124,118,0.2), rgba(27,127,146,0.14));
  box-shadow: inset 0 0 0 1px rgba(10,124,118,0.12);
}

.acc-item.panel {
  background: rgba(255,255,255,0.72);
}
.acc-item.is-open {
  background: rgba(255,255,255,0.9);
}

.auth-visual {
  background:
    radial-gradient(800px 420px at 20% 10%, rgba(26,163,155,0.35), transparent 55%),
    radial-gradient(620px 380px at 90% 80%, rgba(27,127,146,0.28), transparent 55%),
    linear-gradient(160deg, #0b1724 0%, #123047 55%, #0d2434 100%);
}
.demo-user-panel {
  background: rgba(255,255,255,0.78);
  border-color: rgba(13, 27, 42, 0.1);
}
.demo-user-card {
  background: rgba(247, 251, 251, 0.95);
}

.search-shell {
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(13, 27, 42, 0.03);
}

.lams-kpi,
.officer-rail,
.next-due-card,
.facility-summary {
  backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
  .page-hero { padding: 1rem; }
  .topbar { top: 0; border-radius: 14px; }
}

/* ===== Chrome v3: breadcrumbs, active nav, wow motion ===== */
.topbar,
.topbar.topbar-slim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem !important;
  border: 1px solid rgba(12, 26, 40, 0.1) !important;
  border-radius: 14px !important;
  background: rgba(236, 246, 247, 0.96) !important;
  box-shadow: 0 10px 28px rgba(12, 26, 40, 0.08) !important;
  backdrop-filter: blur(14px) saturate(1.1) !important;
  position: sticky;
  top: 0.35rem;
  z-index: 200;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  min-width: 0;
  font-size: 0.92rem;
}
.breadcrumb-sep {
  color: rgba(13, 27, 42, 0.35);
  font-weight: 600;
}
.breadcrumb-link {
  color: var(--ocean-deep);
  font-weight: 700;
  text-decoration: none;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease;
}
.breadcrumb-link:hover {
  background: rgba(10, 124, 118, 0.1);
  color: #054f4b;
}
.breadcrumb-current {
  color: var(--ink);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  max-width: min(52vw, 28rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger-slim,
.topbar-slim .profile-trigger {
  background: rgba(255,255,255,0.55) !important;
  border: 1px solid rgba(13, 27, 42, 0.08);
  box-shadow: 0 8px 20px rgba(13, 27, 42, 0.06);
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border-radius: 999px;
}

.page-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(10, 124, 118, 0.14);
  background:
    linear-gradient(120deg, rgba(10,124,118,0.12), rgba(27,127,146,0.08) 45%, rgba(255,255,255,0.35)),
    rgba(255,255,255,0.35);
  animation: riseSoft 480ms var(--ease-out) both;
}
.page-actions-copy {
  display: grid;
  gap: 0.15rem;
}
.page-actions-copy strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
}
.page-actions-copy span {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

/* Sidebar: open parent is quiet; only the active leaf glows */
.nav-group {
  gap: 0.28rem;
}
.nav-sub {
  margin: 0.15rem 0 0.45rem 0.85rem;
  padding: 0.25rem 0 0.15rem 0.7rem;
  border-left: 1px solid rgba(93, 255, 214, 0.18);
  gap: 0.2rem;
}
.nav-sub-link {
  color: rgba(244, 239, 230, 0.92);
  font-weight: 600;
}
.nav-sub-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: none;
  box-shadow: none;
}
.nav-sub-link.is-active,
.nav-sub a.nav-sub-link.is-active {
  background: linear-gradient(135deg, rgba(26, 163, 155, 0.55), rgba(10, 124, 118, 0.38)) !important;
  color: #fff !important;
  font-weight: 750;
  box-shadow: inset 3px 0 0 #5dffd6, 0 8px 18px rgba(0, 0, 0, 0.18);
  transform: none;
}
.nav-sub-link.is-active::before {
  background: #5dffd6 !important;
  box-shadow: 0 0 10px rgba(93, 255, 214, 0.85);
  width: 7px;
  height: 7px;
}

/* Open module header — readable, not competing with the leaf */
.nav-group.is-open > .nav-parent {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 rgba(93, 255, 214, 0.55);
  border-radius: 12px;
}
.nav-group.is-open > .nav-parent .nav-text strong {
  color: #fff;
}
.nav-group.is-open > .nav-parent .nav-text small {
  color: rgba(255, 255, 255, 0.7);
}
.nav-group.is-open > .nav-parent .nav-caret {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Active leaf-style parent (e.g. top Dashboard) keeps strong highlight */
.nav-link.is-active:not(.nav-parent) {
  background: linear-gradient(135deg, rgba(26, 163, 155, 0.5), rgba(10, 124, 118, 0.34)) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 #5dffd6, 0 10px 22px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
}

/* Wow canvas — richer atmosphere + card contrast */
html, body {
  background-color: #c9e0e4 !important;
  background-image:
    radial-gradient(ellipse 900px 520px at -6% -14%, rgba(12, 186, 168, 0.55), transparent 58%),
    radial-gradient(ellipse 820px 480px at 108% -10%, rgba(36, 142, 178, 0.42), transparent 56%),
    radial-gradient(ellipse 680px 400px at 96% 112%, rgba(230, 150, 48, 0.3), transparent 52%),
    radial-gradient(ellipse 540px 340px at 4% 96%, rgba(8, 132, 118, 0.28), transparent 54%),
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 11px,
      rgba(255, 255, 255, 0.035) 11px,
      rgba(255, 255, 255, 0.035) 12px
    ),
    linear-gradient(148deg, #d8f3ee 0%, #c8e6f0 36%, #e4ecd8 68%, #d2e4e8 100%) !important;
}
.main {
  background:
    radial-gradient(680px 300px at 98% -4%, rgba(12, 186, 168, 0.2), transparent 58%),
    radial-gradient(560px 280px at -4% 102%, rgba(36, 142, 178, 0.14), transparent 55%),
    transparent !important;
}
.main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 0;
  filter: none;
  opacity: 1;
  width: auto;
  height: auto;
  top: 0;
  right: 0;
  background:
    radial-gradient(520px 280px at 86% 6%, rgba(20, 176, 164, 0.28), transparent 66%),
    radial-gradient(460px 260px at 8% 82%, rgba(230, 150, 48, 0.18), transparent 66%),
    radial-gradient(400px 240px at 58% 42%, rgba(36, 142, 178, 0.12), transparent 70%);
  animation: meshDrift 14s ease-in-out infinite alternate;
  z-index: 0;
}
.topbar.topbar-slim {
  background: rgba(236, 246, 247, 0.97) !important;
  padding: 0.65rem 0.85rem !important;
}
.page-actions-bar {
  background:
    linear-gradient(118deg, rgba(10,124,118,0.22), rgba(36,142,178,0.14) 46%, rgba(255,255,255,0.7)),
    rgba(255, 255, 255, 0.72) !important;
  border-color: rgba(10, 124, 118, 0.26) !important;
  box-shadow: 0 16px 36px rgba(12, 26, 40, 0.1);
}
.stat-card,
.panel.panel-pad,
.panel {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(12, 26, 40, 0.11);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 40px rgba(12, 26, 40, 0.1);
}
.table-wrap {
  background: #fff !important;
  border-color: rgba(12, 26, 40, 0.1);
}
.data-table thead th {
  background: #e8f3f3 !important;
  color: #1f3548 !important;
  font-weight: 750;
  position: static;
}
.table-scroll .data-table thead th,
.table-wrap.is-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #e8f3f3 !important;
  box-shadow: 0 1px 0 rgba(12, 26, 40, 0.12);
}
.breadcrumb-current {
  text-shadow: none;
}

/* Compact datetime chips */
.dt-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
  vertical-align: middle;
  max-width: 100%;
}
.dt-badge .dt-date { font-weight: 800; }
.dt-badge .dt-time {
  font-size: 0.68rem;
  font-weight: 650;
  opacity: 0.88;
}
.dt-soft {
  background: #e7eef3;
  color: #334859;
  border-color: #c2d0db;
}
.dt-ocean,
.dt-teal {
  background: #d7f1f4;
  color: #0a5563;
  border-color: #7ebcc8;
}
.dt-amber {
  background: #fde8cc;
  color: #8a3d05;
  border-color: #e3a45a;
}
.dt-rose {
  background: #fadce1;
  color: #8a1f32;
  border-color: #d98a98;
}
.dt-muted {
  background: rgba(15, 28, 46, 0.06);
  color: #5a6b7a;
  border-color: rgba(15, 28, 46, 0.1);
}
.timeline-meta .dt-badge,
.meta-row .dt-badge,
.data-table .dt-badge {
  margin: 0;
}
@keyframes meshDrift {
  from { transform: translate3d(0,0,0) scale(1); opacity: 0.85; }
  to { transform: translate3d(-18px, 12px, 0) scale(1.04); opacity: 1; }
}
@keyframes riseSoft {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-body > * {
  animation: riseSoft 520ms var(--ease-out) both;
}
.page-body > *:nth-child(1) { animation-delay: 40ms; }
.page-body > *:nth-child(2) { animation-delay: 90ms; }
.page-body > *:nth-child(3) { animation-delay: 140ms; }
.page-body > *:nth-child(4) { animation-delay: 190ms; }
.page-body > *:nth-child(5) { animation-delay: 240ms; }

.stat-card {
  overflow: hidden;
}
.stat-card::after {
  animation: orbPulse 4.5s ease-in-out infinite;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.22; }
  50% { transform: scale(1.12); opacity: 0.34; }
}
.stat-value {
  background: linear-gradient(120deg, var(--ink), var(--ocean-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.btn {
  position: relative;
  overflow: hidden;
  transition: transform 180ms var(--ease-out), box-shadow 180ms ease, filter 180ms ease;
}
.btn:hover {
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0); }
.btn-primary,
.btn-teal,
.btn-amber,
.btn-danger {
  box-shadow: 0 12px 28px rgba(13, 27, 42, 0.14);
}

.panel {
  transition: transform 220ms var(--ease-out), box-shadow 220ms ease;
}
.panel:hover {
  box-shadow: 0 20px 44px rgba(13, 27, 42, 0.1);
}

.lams-kpi.is-primary,
.officer-focus-metric {
  position: relative;
  overflow: hidden;
}
.lams-kpi.is-primary::after,
.officer-focus-metric::after {
  content: "";
  position: absolute;
  inset: -40% auto auto -20%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  animation: orbPulse 5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .main::before,
  .main::after,
  .page-body > *,
  .stat-card::after,
  .page-actions-bar { animation: none !important; }
}

/* ===== Spacing rhythm / anti-clubbing (app-wide) ===== */
.panel-pad {
  padding: 1.25rem 1.35rem;
}
.workspace-nav-sticky,
.workspace-nav {
  margin-bottom: 0.15rem;
  padding: 0.7rem 0.8rem;
  gap: 0.65rem;
}
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  min-width: 0;
}
.split-panels {
  gap: 1.4rem;
  align-items: start;
}
.split-panels > .action-block {
  margin-bottom: 0;
  height: 100%;
}
.fee-apply-row {
  margin-top: 0.15rem;
}
.security-form {
  margin-top: 0.15rem;
}
.form-grid .checkbox-row {
  margin: 0.15rem 0;
}
.form-field .helptext {
  margin-top: 0.15rem;
  line-height: 1.4;
}
.form-field .field-error-msg,
.form-field .errorlist {
  margin-top: 0.25rem;
}
.meta-row,
.party-row {
  padding: 0.7rem 0.85rem;
  gap: 0.85rem;
}
.info-tile {
  padding: 0.9rem 1rem;
  gap: 0.35rem;
}
.info-tile.compact {
  margin-top: 0.15rem;
}
.action-modal-body {
  display: grid;
  gap: 1rem;
}
.action-modal-body .form-grid,
.action-modal-body .stack-sm {
  gap: 1.05rem 1.2rem;
}
.action-modal-body .form-field {
  gap: 0.5rem;
}
.filter-bar,
.page-toolbar {
  gap: 0.75rem 0.85rem;
}
.table-wrap + .inline-actions,
.table-wrap + .form-grid,
.stack-sm + .form-grid,
.stack-sm + .inline-actions {
  margin-top: 0.15rem;
}
.data-table-compact td .text-muted {
  margin-top: 0.2rem;
  display: block;
  line-height: 1.4;
  font-size: 0.82rem;
  color: #2a3f52;
}
.officer-rail .panel-pad,
.app-detail-aside .panel-pad {
  padding: 1.15rem 1.2rem;
}
.next-due-card .officer-facts > div,
.officer-rail .officer-facts > div {
  min-height: 2.1rem;
}
.chip-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.form-toggles {
  gap: 0.9rem;
  margin-top: 1.25rem;
}
@media (max-width: 900px) {
  .split,
  .split-panels {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .form-grid .span-2,
  .form-grid .form-actions.span-2 {
    grid-column: 1 / -1;
  }
}

/* ===== Entity forms (no nested .form-grid on <form>) ===== */
.entity-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}
.entity-form > .form-grid,
.entity-form > .form-toggles,
.entity-form > .form-actions,
.entity-form > .checkbox-row {
  width: 100%;
  min-width: 0;
}
.entity-form > .form-actions {
  margin-top: 0;
  padding-top: 1rem;
}
.entity-form > .form-toggles {
  margin-top: 0;
}
.entity-form > .checkbox-row {
  padding: 0.35rem 0;
}

/* Single-column stack: desk rails and explicit stack utility */
.form-grid-stack,
.officer-rail .form-grid,
.officer-rail .entity-form > .form-grid {
  grid-template-columns: 1fr !important;
  gap: 1rem;
}
.form-grid-stack .span-2,
.officer-rail .form-grid .span-2,
.officer-rail .entity-form > .form-grid .span-2 {
  grid-column: 1 / -1;
}

/* Keep entity profile forms multi-column inside action blocks / accordion panels */
.app-detail-main .entity-form > .form-grid,
.app-detail-main .action-block .form-grid,
.app-detail-main .acc-panel .form-grid,
.form-shell .form-grid,
.form-panel .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.app-detail-main .entity-form > .form-grid.form-grid-dense,
.app-detail-main .action-block .form-grid.form-grid-dense,
.app-detail-main .acc-panel .form-grid.form-grid-dense {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}
@media (min-width: 960px) {
  .app-detail-main .entity-form > .form-grid.form-grid-dense,
  .app-detail-main .action-block .form-grid.form-grid-dense,
  .app-detail-main .acc-panel .form-grid.form-grid-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .app-detail-main .entity-form > .form-grid,
  .app-detail-main .action-block .form-grid,
  .app-detail-main .acc-panel .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-field select.field-control,
.form-field .field-control,
.entity-form select,
.entity-form input,
.entity-form textarea {
  max-width: 100%;
  box-sizing: border-box;
}
.form-field select {
  text-overflow: ellipsis;
}

/* Fees + securities: stack on typical laptop widths so forms get full width */
@media (max-width: 1400px) {
  .app-detail-layout .split-panels {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 1401px) {
  .app-detail-layout .split-panels {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
}

/* ===== Table header/body separation (app-wide) ===== */
.data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
.data-table thead {
  position: relative;
  z-index: 2;
}
.data-table thead th {
  position: static;
  background: #e8f3f3 !important;
  color: #1f3548 !important;
  padding: 0.75rem 0.8rem !important;
  line-height: 1.4;
  vertical-align: middle !important;
  border-bottom: 1px solid rgba(12, 26, 40, 0.14) !important;
  box-shadow: none;
}
.data-table tbody td {
  background-clip: padding-box;
  padding: 0.75rem 0.8rem;
  vertical-align: middle;
  line-height: 1.45;
}
.data-table-compact thead th,
.data-table-compact tbody td {
  padding: 0.65rem 0.7rem !important;
}
.data-table tbody tr:first-child td {
  padding-top: 0.8rem;
}
.table-scroll {
  max-height: 22rem;
  overflow: auto;
  border-radius: 12px;
}
.table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #e8f3f3 !important;
  box-shadow: inset 0 -1px 0 rgba(12, 26, 40, 0.14);
}

.code-block {
  margin: 0.65rem 0 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 28, 46, 0.03);
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  overflow-x: auto;
}
.payload-toggle {
  cursor: pointer;
  list-style: none;
}
.payload-toggle::-webkit-details-marker { display: none; }
.payload-toggle::before {
  content: "▸ ";
  color: var(--ink-soft);
}
details[open] > .payload-toggle::before { content: "▾ "; }

/* ===== External integration panels ===== */
.integration-panel {
  margin: 0.85rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px dashed rgba(23, 106, 122, 0.45);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(23, 106, 122, 0.06), rgba(23, 106, 122, 0.02));
}
.integration-panel + .integration-panel { margin-top: 0.75rem; }
.integration-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.integration-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: rgba(23, 106, 122, 0.14);
  color: #10535f;
}
.integration-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.integration-owner {
  font-size: 0.78rem;
  color: #2a3f52;
  font-weight: 600;
}
.integration-desc {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #243746;
}
.integration-panel-foot {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.integration-note {
  margin: 0;
  font-size: 0.8rem;
  color: #2a3f52;
  font-style: italic;
  flex: 1 1 16rem;
}

/* ===== Printable letters (sanction / NOC / statement) ===== */
.letter-sheet {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.4rem 2.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #10233b;
  font-size: 0.9rem;
  line-height: 1.65;
}
.letter-head {
  text-align: center;
  border-bottom: 2px solid #10233b;
  padding-bottom: 0.9rem;
  margin-bottom: 1.4rem;
}
.letter-head h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.02em; }
.letter-head p { margin: 0.2rem 0 0; font-size: 0.8rem; color: #4a5d75; }
.letter-title {
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.2rem 0;
  text-decoration: underline;
}
.letter-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.82rem; }
.letter-table { width: 100%; border-collapse: collapse; margin: 0.9rem 0; font-size: 0.85rem; }
.letter-table th, .letter-table td { border: 1px solid #b9c6d6; padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.letter-table th { background: #eef3f8; width: 38%; font-weight: 600; }
.letter-list { margin: 0.5rem 0 0 1.1rem; padding: 0; }
.letter-list li { margin-bottom: 0.35rem; }
.letter-sign { margin-top: 2.6rem; display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.letter-sign-block { min-width: 12rem; }
.letter-sign-line { margin-top: 2.8rem; border-top: 1px solid #10233b; padding-top: 0.3rem; font-size: 0.8rem; }
.letter-foot { margin-top: 1.8rem; font-size: 0.74rem; color: #64748b; border-top: 1px dashed #b9c6d6; padding-top: 0.6rem; }
.print-toolbar { max-width: 48rem; margin: 0 auto 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }

/* Digital acknowledgement stamp on letters */
.letter-esign {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}
.letter-esign-stamp {
  display: inline-block;
  min-width: 14rem;
  max-width: 22rem;
  padding: 0.65rem 0.85rem 0.75rem;
  border: 2px solid rgba(10, 124, 118, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(10, 124, 118, 0.06), rgba(255, 255, 255, 0.9));
  box-shadow: inset 0 0 0 1px rgba(10, 124, 118, 0.12);
}
.letter-esign-stamp strong {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0a7c76;
  margin-bottom: 0.25rem;
}
.letter-esign-name {
  margin: 0;
  font-family: "Segoe Script", "Brush Script MT", "Apple Chancery", cursive;
  font-size: 1.45rem;
  line-height: 1.15;
  color: #10233b;
  font-weight: 600;
}
.letter-esign-meta {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #4a5d75;
}
.letter-esign-id {
  margin: 0.2rem 0 0;
  font-size: 0.68rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #64748b;
  word-break: break-all;
}
.letter-sign-block .letter-esign {
  margin-top: 0.5rem;
}
.letter-sign-block .letter-sign-line {
  margin-top: 1.1rem;
}

@media print {
  @page {
    size: A4;
    margin: 14mm 16mm;
  }

  html,
  body,
  body.app-body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .topbar,
  .topbar.topbar-slim,
  .print-toolbar,
  .messages,
  .toast-host,
  .csrf-slot,
  .confirm-dialog,
  .action-modal,
  .doc-preview-modal,
  .msg-preview-modal,
  .cell-clip-modal,
  [data-confirm-dialog],
  [data-action-modal],
  [data-doc-preview-modal],
  [data-msg-preview-modal],
  [data-cell-clip-modal],
  .profile-dropdown {
    display: none !important;
    visibility: hidden !important;
  }

  .app-shell {
    display: block !important;
    grid-template-columns: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .main,
  .page-body {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    position: static !important;
  }

  .letter-sheet {
    border: 0 !important;
    border-radius: 0 !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.5;
    page-break-inside: auto;
  }

  .letter-head {
    border-bottom-color: #000 !important;
  }
  .letter-table {
    page-break-inside: avoid;
  }
  .letter-table th,
  .letter-table td {
    border-color: #333 !important;
    color: #000 !important;
    background: #fff !important;
  }
  .letter-table th {
    background: #f0f0f0 !important;
  }
  .letter-sign {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .letter-esign-stamp {
    border-color: #0a7c76 !important;
    background: #f3faf9 !important;
  }
  .letter-foot {
    color: #444 !important;
    border-top-color: #999 !important;
  }

  a[href]::after {
    content: none !important;
  }
}

/* ===== Demo UI polish — actions, overdue emphasis ===== */
th.col-actions,
th.table-actions,
td.table-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
  vertical-align: middle !important;
}
td.table-actions {
  display: table-cell;
  padding-right: 0.95rem !important;
}
td.table-actions .inline-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}
td.table-actions form,
td.table-actions .inline-form {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin: 0;
  vertical-align: middle;
}
td.table-actions .btn,
.btn-row {
  min-width: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.2;
  border-radius: 9px;
}
td.table-actions .btn-sm {
  min-width: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.data-table thead th {
  color: #0c1a28 !important;
  font-size: 0.8rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.05em;
  background: #d7e8ea !important;
}
.data-table tbody td {
  border-bottom-color: rgba(12, 26, 40, 0.1);
  color: var(--ink);
}
.list-row-alert td {
  background: rgba(163, 59, 74, 0.07);
}
.list-row-alert:hover td {
  background: rgba(163, 59, 74, 0.11);
}
.list-row-alert td.table-actions .btn-primary {
  box-shadow: 0 8px 16px rgba(6, 90, 86, 0.28);
}

.text-overdue,
.num-overdue {
  color: #8a1f32 !important;
  font-weight: 750;
}
.num-overdue {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-badge.status-overdue {
  background: #fadce1;
  color: #8a1f32;
  border-color: #d98a98;
  box-shadow: 0 0 0 1px rgba(163, 59, 74, 0.14);
  font-weight: 850;
}

.lams-kpi.is-alert .lams-kpi-label {
  color: #8a1f32;
}
.recovery-card-head .num-overdue {
  font-size: 0.95rem;
}

.page-toolbar-actions,
.page-hero-actions,
.inline-actions,
.filter-actions,
.action-stack {
  align-items: center;
}
.page-toolbar-actions .btn,
.page-hero-actions .btn {
  white-space: nowrap;
}

.integration-panel {
  margin: 0 0 1rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(23, 106, 122, 0.28);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(232, 244, 245, 0.9));
  box-shadow: none;
}
.integration-panel.is-hint-only {
  padding: 0.85rem 1.05rem;
}
.integration-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.integration-panel-copy {
  flex: 1 1 16rem;
  min-width: 0;
}
.integration-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--ink);
  font-family: var(--font-display);
}
.integration-desc {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #1e3346 !important;
  max-width: 75ch;
}
.integration-note {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #2a3f52;
  font-style: italic;
}
.integration-ref {
  margin: 0.45rem 0 0;
  color: #2a3f52;
}
.integration-actions {
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.panel > .table-wrap:last-child,
.panel-pad > .table-wrap:last-child {
  margin-bottom: 0;
}
.panel-pad > .table-wrap + .pagination-bar {
  margin-top: 0.85rem;
}

/* ===== UI recovery — stop crushed tables / faint chrome ===== */
.main,
.page-body,
.panel,
.panel-pad,
.table-wrap {
  min-width: 0;
  max-width: 100%;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overflow-anchor: none;
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(12, 26, 40, 0.38) rgba(12, 26, 40, 0.07);
}
.table-wrap::-webkit-scrollbar {
  height: 11px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(12, 26, 40, 0.34);
  border-radius: 999px;
  border: 2px solid #fff;
}
.table-wrap::-webkit-scrollbar-track {
  background: rgba(12, 26, 40, 0.07);
  border-radius: 999px;
}

.data-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
}
.data-table thead th {
  color: #0c1a28 !important;
  background: #d2e6e8 !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(12, 26, 40, 0.16) !important;
}
/* Keep header bar flush edge-to-edge inside rounded table-wrap */
.table-wrap > .data-table thead th:first-child {
  border-top-left-radius: 13px;
}
.table-wrap > .data-table thead th:last-child {
  border-top-right-radius: 13px;
}
.data-table thead th.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.data-table tbody td {
  color: #0c1a28;
  font-size: 0.92rem;
}
.data-table .text-muted,
.panel .text-muted,
td .text-muted {
  color: #334859 !important;
  opacity: 1 !important;
  font-size: 0.86rem;
}

/* Datetime chips — readable, not washed out */
.dt-badge {
  font-size: 0.78rem;
  font-weight: 750;
}
.dt-soft {
  background: #dce6ec !important;
  color: #1a2f40 !important;
  border-color: #9eb0bd !important;
}
.dt-soft .dt-time {
  color: #334859;
  opacity: 1;
}

/* Secondary / outline buttons — transparent fill (Open / row nav style) */
.btn-secondary,
.btn-soft,
td.table-actions .btn-secondary,
.inline-actions .btn-secondary {
  background: transparent !important;
  color: #0c1a28 !important;
  border: 1.5px solid rgba(12, 26, 40, 0.38) !important;
  box-shadow: none !important;
  font-weight: 750;
}
.btn-secondary:hover,
.btn-soft:hover,
td.table-actions .btn-secondary:hover,
.inline-actions .btn-secondary:hover {
  background: rgba(12, 26, 40, 0.05) !important;
  border-color: rgba(12, 26, 40, 0.55) !important;
  color: #0c1a28 !important;
  transform: none;
}

/* Table row Open / navigate actions — always outline, never filled */
.data-table td > a.btn.btn-secondary,
.data-table td .inline-actions > a.btn.btn-secondary,
.data-table td.table-actions > a.btn.btn-secondary {
  background: transparent !important;
  color: #0c1a28 !important;
  border: 1.5px solid rgba(12, 26, 40, 0.38) !important;
  box-shadow: none !important;
}
.data-table td > a.btn.btn-secondary:hover,
.data-table td .inline-actions > a.btn.btn-secondary:hover,
.data-table td.table-actions > a.btn.btn-secondary:hover {
  background: rgba(12, 26, 40, 0.05) !important;
  border-color: rgba(12, 26, 40, 0.55) !important;
  color: #0c1a28 !important;
}

/* Row actions: compact horizontal group — never force wide min-widths */
th.col-actions,
th.table-actions,
td.table-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle !important;
}
td.table-actions {
  display: table-cell !important;
  padding-left: 0.5rem !important;
  padding-right: 0.85rem !important;
}
td.table-actions .inline-actions {
  display: inline-flex !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: none;
}
td.table-actions .inline-form,
td.table-actions form.inline-form,
td.table-actions form.inline-actions {
  display: inline-flex !important;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}
td.table-actions .btn,
td.table-actions .btn-sm,
td.table-actions .btn-row,
.btn-row {
  min-width: 0 !important;
  width: auto !important;
  flex: 0 0 auto !important;
  padding: 0.4rem 0.7rem !important;
  font-size: 0.8rem !important;
  font-weight: 750;
  line-height: 1.2;
  border-radius: 9px;
  box-shadow: none;
  white-space: nowrap;
}
td.table-actions .btn-primary,
td.table-actions .btn-teal {
  box-shadow: 0 2px 6px rgba(6, 90, 86, 0.2);
}

/* Status pills stay crisp */
.status-badge {
  color: #1a2b3c;
  font-weight: 800;
  border-width: 1px;
}

/* Filter chrome contrast */
.filter-bar .field-control,
.filter-bar-rich .field-control,
.filter-bar .filter-select,
.search-shell .search-input {
  background: #fff;
  color: #0c1a28;
  border-color: rgba(12, 26, 40, 0.18);
}
.search-shell .search-input::placeholder {
  color: #8a9aac;
  opacity: 1;
}

/* Notification / dense desks: subject breathes, actions stay tight */
.data-table-readable td {
  vertical-align: middle;
}
.data-table-readable td .text-muted {
  margin-top: 0.2rem;
  max-width: 42rem;
}
@media (max-width: 1100px) {
  td.table-actions .inline-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* ===== Portal alignment recovery ===== */
.filter-bar {
  align-items: flex-end;
}
.filter-bar > .btn,
.filter-bar > button.btn {
  height: 2.85rem;
  align-self: flex-end;
}
.filter-bar .form-field,
.filter-bar .field,
.filter-bar label.field {
  margin-bottom: 0;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: flex-end;
}
.filter-bar .form-field .field-control,
.filter-bar .field .field-control,
.filter-bar .field-control,
.filter-bar select,
.filter-bar input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  height: 2.85rem;
  min-height: 2.85rem;
  box-sizing: border-box;
}
.filter-bar .filter-actions {
  align-self: flex-end;
}
.page-toolbar-actions,
.page-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}
.page-toolbar .filter-actions,
.page-toolbar-rich .filter-actions {
  gap: 0.55rem;
}

.split.mb-1,
.split:has(> .integration-panel) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1.15rem;
}
.split > .integration-panel {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.split > .integration-panel .integration-panel-head {
  align-items: flex-start;
}
.split > .integration-panel .integration-desc {
  flex: 1 1 auto;
}

.status-stack {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

th.col-actions,
th.table-actions {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  vertical-align: middle;
}
.data-table tbody td {
  vertical-align: middle;
}

.nav-link,
.nav-parent,
a.nav-link {
  display: flex !important;
  align-items: center !important;
}
.nav-icon {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  display: grid;
  place-items: center;
  line-height: 1;
  overflow: hidden;
}
.nav-icon .ui-icon,
.nav-icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}
.nav-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.2;
}
.nav-sub-link {
  display: flex !important;
  align-items: center;
  line-height: 1.25;
}
.nav-nested-sub {
  margin-left: 0.35rem;
  padding-left: 0.45rem;
}
.nav-nested-sub .nav-sub-link {
  padding-right: 0.55rem;
}

.nav-badge,
.nav-sub-link .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-top: 0;
  padding-bottom: 0;
}

.topbar,
.page-topbar,
.breadcrumbs {
  align-items: center;
}
.breadcrumbs {
  padding-left: 0.15rem;
}

/* ===== Detail desks + status graphs (equal height, no fake scroll) ===== */
.flow-track,
.flow-track-window {
  align-items: stretch;
}
.flow-step,
.flow-track-window .flow-step {
  min-height: 5.75rem;
  transform: none !important;
  align-self: stretch;
}
.flow-step.is-current {
  transform: none !important;
  border-width: 1px !important;
}
.flow-step .flow-state {
  margin-top: auto;
}

.app-detail-aside {
  max-height: calc(100vh - 5.4rem);
  min-height: 0;
}
.officer-rail:not(.officer-rail-shell > .officer-rail) {
  max-height: none !important;
  overflow: visible !important;
}
.app-detail-aside > .officer-rail,
.app-detail-aside > .stack > .officer-rail,
aside.app-detail-aside .officer-rail {
  max-height: none;
  overflow: visible;
}
.officer-rail-shell:has(> .history-panel) {
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
.officer-rail-shell:has(> .history-panel) > .officer-rail {
  max-height: none !important;
  overflow: visible !important;
  flex: 0 0 auto;
}
.officer-rail-shell:has(> .history-panel) > .history-panel {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

/* Borrower / structure desks */
.structure-block {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid rgba(12, 26, 40, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}
.structure-block + .structure-block {
  margin-top: 1rem;
}
.structure-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.structure-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(12, 26, 40, 0.12);
}
.structure-form > .form-toggles:not(:has(.toggle-field)) {
  display: none;
}
.structure-form > .form-actions {
  margin: 0;
  padding: 0;
  justify-content: flex-start;
}
.structure-form .form-grid.form-grid-dense .form-field {
  margin: 0;
}
.acc-panel .structure-form .form-grid.form-grid-dense {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.85rem 1rem;
}
@media (min-width: 960px) {
  .acc-panel .structure-form .form-grid.form-grid-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 700px) {
  .acc-panel .structure-form .form-grid.form-grid-dense {
    grid-template-columns: 1fr !important;
  }
}
.form-shell.structure-form .form-toggles,
.structure-form .form-toggles {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.structure-form .toggle-field {
  padding: 0.45rem 0.65rem;
  min-height: 0;
  align-items: center;
}

/* ===== MIS reports catalogue ===== */
.mis-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: end;
  margin-bottom: 1.1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 16px;
  border: 1px solid rgba(12, 26, 40, 0.08);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(31, 158, 151, 0.14), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(232, 242, 241, 0.75));
}
.mis-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ocean-deep);
  font-weight: 700;
}
.mis-title {
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: -0.02em;
  color: #0c1a28;
}
.mis-lede {
  margin: 0;
  max-width: 60rem;
  color: #2a3f52;
  font-size: 0.95rem;
  line-height: 1.45;
}
.mis-hero-stat {
  min-width: 7.5rem;
  text-align: right;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: rgba(11, 110, 106, 0.08);
  border: 1px solid rgba(11, 110, 106, 0.18);
}
.mis-hero-stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1;
  color: var(--ocean-deep);
  font-variant-numeric: tabular-nums;
}
.mis-hero-stat-label {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #2a3f52;
}
.mis-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}
.mis-jump a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
  color: #0c1a28;
  font-size: 0.82rem;
  text-decoration: none;
}
.mis-jump a:hover {
  border-color: rgba(11, 110, 106, 0.4);
  color: var(--ocean-deep);
}
.mis-jump em {
  font-style: normal;
  font-weight: 700;
  color: var(--ocean);
  font-variant-numeric: tabular-nums;
}
.mis-group {
  margin-bottom: 1.5rem;
}
.mis-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(12, 26, 40, 0.1);
}
.mis-group-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #0c1a28;
}
.mis-group-head span {
  font-size: 0.8rem;
  color: #5a6f82;
}
.mis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.mis-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  min-height: 6.4rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.62);
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.mis-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 110, 106, 0.38);
  box-shadow: 0 12px 28px rgba(15, 28, 46, 0.08);
}
.mis-card-num {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--ocean-deep);
  font-variant-numeric: tabular-nums;
  min-width: 1.6rem;
  line-height: 1.35;
}
.mis-card-body {
  display: grid;
  gap: 0.28rem;
  align-content: start;
}
.mis-card-title {
  font-size: 1rem;
  line-height: 1.3;
  color: #0c1a28;
}
.mis-card-desc {
  font-size: 0.84rem;
  line-height: 1.4;
  color: #2a3f52;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.35rem;
}
.mis-card-aud {
  font-size: 0.72rem;
  color: #5a6f82;
  letter-spacing: 0.02em;
}
.mis-card-go {
  color: #1f9e97;
  font-size: 1.1rem;
  margin-top: 0.1rem;
}
.mis-filters {
  margin-bottom: 1rem;
}
.mis-filter-form {
  display: grid;
  gap: 0.85rem;
}
.mis-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.mis-filter-grid label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #5a6f82;
  font-weight: 650;
}
.mis-filter-grid select,
.mis-filter-grid input {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #0c1a28;
  font-size: 0.9rem;
}
.mis-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}
.mis-filter-active {
  font-size: 0.82rem;
  color: var(--ocean-deep);
  font-weight: 650;
}
@media (max-width: 900px) {
  .mis-hero { grid-template-columns: 1fr; }
  .mis-hero-stat { text-align: left; width: fit-content; }
  .mis-grid { grid-template-columns: 1fr; }
  .mis-filter-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .mis-filter-grid { grid-template-columns: 1fr; }
}

/* ===== Form / table input contrast (risk heads & similar) =====
   Gradient text utilities set -webkit-text-fill-color: transparent which can
   inherit onto controls in WebKit; disabled inputs also wash out on light cells. */
.field-control,
.form-field input,
.form-field select,
.form-field textarea,
.data-table .field-control,
.data-table input[type="text"],
.data-table input[type="number"],
.data-table input[type="email"],
.data-table input[type="password"],
.data-table input[type="date"],
.data-table input[type="search"],
.data-table select,
.data-table textarea {
  color: #0c1a28 !important;
  -webkit-text-fill-color: #0c1a28 !important;
  caret-color: #0c1a28;
  opacity: 1 !important;
}

/* Placeholders must NOT inherit solid ink fill — otherwise empty fields look filled. */
.field-control::placeholder,
.form-field input::placeholder,
.form-field textarea::placeholder,
.form-field select::placeholder,
.search-shell .search-input::placeholder,
.mis-filter-form input::placeholder,
.filter-bar .field-control::placeholder,
.data-table .field-control::placeholder,
.data-table input::placeholder,
.data-table textarea::placeholder {
  color: #8a9aac !important;
  -webkit-text-fill-color: #8a9aac !important;
  opacity: 1 !important;
  font-weight: 400 !important;
}
.field-control::-webkit-input-placeholder,
.form-field input::-webkit-input-placeholder,
.form-field textarea::-webkit-input-placeholder {
  color: #8a9aac !important;
  -webkit-text-fill-color: #8a9aac !important;
  opacity: 1 !important;
}

/* .form-field { display:grid } beats UA [hidden] in some engines — force hide. */
.form-field[hidden],
[data-desk-drop-wrap][hidden],
[data-desk-remarks-wrap][hidden] {
  display: none !important;
}

.field-control:disabled,
.field-control[disabled],
.field-control[readonly],
.data-table input:disabled,
.data-table input[readonly],
.form-field input:disabled,
.form-field input[readonly],
.form-field select:disabled,
.form-field textarea:disabled {
  color: #1f3548 !important;
  -webkit-text-fill-color: #1f3548 !important;
  background: #f3f6f7 !important;
  opacity: 1 !important;
  -webkit-text-security: none;
}

.field-control::selection,
.data-table input::selection,
.data-table td::selection,
.form-field input::selection,
.form-field textarea::selection {
  background: rgba(10, 124, 118, 0.28);
  color: #0c1a28;
}

.data-table tbody tr:hover .field-control,
.data-table tbody tr:hover input {
  color: #0c1a28 !important;
  -webkit-text-fill-color: #0c1a28 !important;
}


/* ===== Table primary identity links ===== */
.data-table td:first-child > a,
.data-table td:first-child > a > strong,
.data-table a[href] > strong {
  color: var(--ocean-deep);
  font-weight: 700;
  text-decoration: none;
}
.data-table td:first-child > a:hover,
.data-table td:first-child > a:hover > strong {
  color: var(--ocean);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* ===== Holiday calendar ===== */
/* Fill .main without relying on fragile 100vh math (topbar + padding caused a leftover scrollbar). */
.main:has(.holiday-cal-page) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0.85rem;
  scrollbar-gutter: auto;
}
.main:has(.holiday-cal-page) > .topbar {
  flex-shrink: 0;
  margin-bottom: 0.65rem;
}
.main:has(.holiday-cal-page) > .page-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.holiday-cal-page {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
  overflow: hidden;
}
.holiday-cal-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.7rem;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.78), rgba(247,251,251,0.62));
  border: 1px solid rgba(13, 27, 42, 0.08);
  box-shadow: 0 8px 20px rgba(13, 27, 42, 0.04);
  flex-shrink: 0;
}
.holiday-cal-topbar .holiday-cal-view-toggle {
  grid-column: 2;
  justify-self: center;
}
.holiday-cal-topbar-actions {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.holiday-cal-panel {
  overflow: hidden;
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.holiday-cal-panel.panel-pad {
  padding: 0.55rem 0.75rem 0.6rem;
}
.holiday-cal-note {
  margin: 0 0 0.35rem;
  padding: 0.22rem 0.5rem;
  font-size: 0.64rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--ink-soft);
  background: rgba(12, 26, 40, 0.04);
  border: 1px solid rgba(12, 26, 40, 0.06);
  border-radius: 8px;
  flex-shrink: 0;
}
.holiday-cal-note strong {
  font-weight: 700;
  color: var(--ink);
}

.holiday-cal-view-toggle {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.18rem;
  width: fit-content;
  border-radius: 999px;
  background: rgba(12, 26, 40, 0.06);
  border: 1px solid rgba(12, 26, 40, 0.08);
}
.holiday-cal-view-toggle .btn {
  border-radius: 999px;
  min-width: 5.2rem;
}

.holiday-cal {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.holiday-cal-toolbar {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
  width: 100%;
  flex-shrink: 0;
}
.holiday-cal-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}
.holiday-cal-heading {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  text-align: center;
}
.holiday-cal-month {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  font-weight: 650;
  color: var(--ocean-deep);
  letter-spacing: -0.02em;
}

.holiday-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
}
.holiday-cal-grid-month {
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.35rem;
  align-content: stretch;
}
.holiday-cal-grid-month > .holiday-cal-dow {
  align-self: end;
}
.holiday-cal-grid-month > .holiday-cal-day {
  min-height: 0;
  height: 100%;
}
.holiday-cal-dow {
  padding: 0.2rem 0.1rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.78;
}
.holiday-cal-day {
  --day-min: 4.2rem;
  position: relative;
  min-height: var(--day-min);
  margin: 0;
  padding: 0.4rem 0.4rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  border: 1px solid rgba(12, 26, 40, 0.1);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 246, 247, 0.9));
  box-shadow: 0 6px 14px rgba(12, 26, 40, 0.04);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    background 160ms var(--ease-out);
}
button.holiday-cal-day:hover,
button.holiday-cal-day:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(10, 124, 118, 0.42);
  box-shadow: 0 10px 20px rgba(10, 124, 118, 0.12);
  outline: none;
}
button.holiday-cal-day:hover .holiday-cal-hint { opacity: 1; }
.holiday-cal-day.is-outside {
  opacity: 0.38;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}
.holiday-cal-day.is-today:not(.is-holiday) {
  border-color: rgba(10, 124, 118, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(10, 124, 118, 0.18),
    0 8px 16px rgba(10, 124, 118, 0.1);
}
.holiday-cal-day.is-today:not(.is-holiday) .holiday-cal-num {
  background: var(--ocean);
  color: #fff;
}
.holiday-cal-day.is-holiday {
  background:
    linear-gradient(155deg, #f6b14a 0%, #e8922a 42%, #d97816 100%);
  border-color: #b8640f;
  box-shadow:
    0 8px 16px rgba(196, 107, 26, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  color: #3a2208;
}
.holiday-cal-day.is-holiday .holiday-cal-num {
  background: rgba(58, 34, 8, 0.18);
  color: #2f1a05;
  font-weight: 800;
}
.holiday-cal-day.is-holiday .holiday-cal-name {
  color: #2f1a05;
  font-weight: 750;
}
button.holiday-cal-day.is-holiday:hover,
button.holiday-cal-day.is-holiday:focus-visible {
  border-color: #8f4c0c;
  box-shadow: 0 12px 22px rgba(196, 107, 26, 0.3);
}
.holiday-cal-day.is-holiday.is-today {
  box-shadow:
    0 0 0 2px rgba(6, 90, 86, 0.55),
    0 10px 18px rgba(196, 107, 26, 0.28);
}
.holiday-cal-day.is-holiday.is-inactive {
  background:
    linear-gradient(155deg, #e8b4b8 0%, #d48790 55%, #c46a74 100%);
  border-color: #9a4450;
  color: #4a1c24;
}
.holiday-cal-day.is-holiday.is-inactive .holiday-cal-num,
.holiday-cal-day.is-holiday.is-inactive .holiday-cal-name {
  color: #3d151c;
}

.holiday-cal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  color: var(--ocean-deep);
  background: rgba(10, 124, 118, 0.1);
}
.holiday-cal-name {
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--ocean-deep);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.holiday-cal-hint {
  margin-top: auto;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ocean);
  opacity: 0;
  transition: opacity 160ms var(--ease-out);
}

.holiday-cal-year {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
.holiday-cal-mini {
  min-width: 0;
  min-height: 0;
  padding: 0.35rem 0.4rem 0.4rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(12, 26, 40, 0.08);
  box-shadow: 0 6px 14px rgba(12, 26, 40, 0.04);
  display: flex;
  flex-direction: column;
}
.holiday-cal-mini-head {
  margin: 0 0 0.2rem;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.1;
}
.holiday-cal-mini-head a {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ocean-deep);
  text-decoration: none;
}
.holiday-cal-mini-head a:hover {
  color: var(--ocean);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.holiday-cal-grid-mini {
  gap: 0.1rem;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
  grid-auto-rows: minmax(0, 1fr);
}
.holiday-cal-grid-mini .holiday-cal-dow {
  padding: 0;
  font-size: 0.55rem;
  line-height: 1;
}
.holiday-cal-day.is-compact {
  --day-min: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}
.holiday-cal-day.is-compact .holiday-cal-num {
  min-width: 1.05rem;
  height: 1.05rem;
  font-size: 0.62rem;
  background: transparent;
}
.holiday-cal-day.is-compact.is-holiday .holiday-cal-num {
  background: rgba(58, 34, 8, 0.16);
  color: #2f1a05;
  font-weight: 800;
}
.holiday-cal-day.is-compact.is-outside {
  background: transparent;
  border-color: transparent;
}

.holiday-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 0.45rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.holiday-cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.holiday-cal-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(12, 26, 40, 0.12);
  background: #fff;
}
.holiday-cal-swatch.is-holiday {
  background: linear-gradient(155deg, #f6b14a, #d97816);
  border-color: #b8640f;
}
.holiday-cal-swatch.is-today {
  background: var(--ocean);
  border-color: var(--ocean-deep);
}
.holiday-cal-swatch.is-inactive {
  background: linear-gradient(155deg, #e8b4b8, #c46a74);
  border-color: #9a4450;
}

@media (max-width: 1280px) {
  .holiday-cal-year {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .main:has(.holiday-cal-page) {
    overflow-y: auto;
  }
  .holiday-cal-page {
    max-height: none;
    min-height: 0;
    height: auto;
    overflow: visible;
  }
  .holiday-cal-year {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
  .holiday-cal-day.is-compact { min-height: 1.45rem; }
}
@media (max-width: 900px) {
  .holiday-cal-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .holiday-cal-topbar .holiday-cal-view-toggle,
  .holiday-cal-topbar-actions {
    grid-column: 1;
    justify-self: center;
  }
  .holiday-cal-nav {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .holiday-cal-heading { flex-direction: column; gap: 0.25rem; }
  .holiday-cal-day:not(.is-compact) { --day-min: 3.8rem; padding: 0.35rem; border-radius: 10px; }
  .holiday-cal-name { font-size: 0.64rem; -webkit-line-clamp: 2; }
  .holiday-cal-hint { display: none; }
}
@media (max-width: 640px) {
  .holiday-cal-year { grid-template-columns: 1fr; }
  .holiday-cal-grid:not(.holiday-cal-grid-mini) { gap: 0.25rem; }
  .holiday-cal-day:not(.is-compact) { --day-min: 3.2rem; }
  .holiday-cal-day:not(.is-compact) .holiday-cal-num {
    min-width: 1.3rem;
    height: 1.3rem;
    font-size: 0.74rem;
  }
}

/* ===== Dashboard chart grids ===== */
.dash-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.dash-chart-grid .chart-panel {
  min-width: 0;
}
.dash-chart-grid .chart-panel:nth-child(1) { --stagger: 40ms; }
.dash-chart-grid .chart-panel:nth-child(2) { --stagger: 90ms; }
.dash-chart-grid .chart-panel:nth-child(3) { --stagger: 140ms; }
.dash-chart-grid .chart-panel:nth-child(4) { --stagger: 190ms; }
.dash-chart-grid .chart-wrap {
  height: 260px;
}
.dash-chart-grid .chart-wrap-tall {
  height: 300px;
}
.dash-chart-grid .chart-wrap-donut {
  height: 280px;
}
.stat-grid-dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .dash-chart-grid { grid-template-columns: 1fr; }
  .stat-grid-dense { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stat-grid-dense { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .chart-panel,
  .chart-panel.has-chart:hover,
  .chart-panel .chart-wrap {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .chart-panel .chart-wrap::after { display: none; }
}

/* Export split menu — keep above filter panels (.main > * stacking). */
.page-actions-bar {
  position: relative;
  z-index: 20;
  overflow: visible;
}
.page-actions-bar .page-hero-actions {
  position: relative;
  z-index: 21;
  overflow: visible;
}
.export-menu {
  position: relative;
  display: inline-flex;
  z-index: 1;
}
.export-menu.is-open {
  z-index: 80;
}
.export-menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 10rem;
  padding: 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 28px rgba(12, 26, 40, 0.12);
  z-index: 90;
  display: none;
  gap: 0.15rem;
}
.export-menu.is-open .export-menu-panel,
.export-menu-panel:not([hidden]) {
  display: grid !important;
}
.export-menu-panel[hidden] {
  display: none !important;
}
.export-menu-item {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: #0c1a28;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.export-menu-item:hover {
  background: rgba(14, 116, 144, 0.08);
  color: var(--ocean-deep);
}
.export-progress {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 40, 0.35);
  display: grid;
  place-items: center;
  z-index: 1200;
}
.export-progress[hidden] { display: none !important; }
.export-progress-card {
  width: min(22rem, calc(100vw - 2rem));
  background: #fff;
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 18px 40px rgba(12, 26, 40, 0.18);
}
.export-progress-bar {
  margin-top: 0.85rem;
  height: 0.4rem;
  border-radius: 999px;
  background: #e6eef4;
  overflow: hidden;
}
.export-progress-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0e7490, #14b8a6);
  animation: export-indeterminate 1.1s ease-in-out infinite;
}
@keyframes export-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
.detail-jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ocean-deep);
  font-size: 0.85rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.detail-jump:hover {
  background: rgba(14, 116, 144, 0.08);
}
.desk-stage-form .form-actions {
  margin-top: 0.35rem;
}

/* ===== Global app loader (harbor orbit) ===== */
.app-loader {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease-out), visibility 0.28s var(--ease-out);
}
.app-loader.is-active,
.app-loader.is-boot {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.app-loader[hidden] {
  display: none !important;
}
.app-loader-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(10, 124, 118, 0.22), transparent 70%),
    rgba(11, 23, 36, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.app-loader-card {
  position: relative;
  z-index: 1;
  width: min(20.5rem, calc(100vw - 2rem));
  padding: 1.45rem 1.35rem 1.25rem;
  border-radius: 18px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(232, 244, 246, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 22px 50px rgba(8, 18, 28, 0.28);
  text-align: center;
}
.app-loader-orbit {
  position: relative;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 1rem;
}
.app-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.app-loader-ring-a {
  inset: 0;
  border-top-color: var(--ocean);
  border-right-color: rgba(10, 124, 118, 0.25);
  animation: app-loader-spin 1.1s linear infinite;
}
.app-loader-ring-b {
  inset: 0.45rem;
  border-bottom-color: var(--teal);
  border-left-color: rgba(27, 127, 146, 0.3);
  animation: app-loader-spin 1.65s linear infinite reverse;
}
.app-loader-ring-c {
  inset: 0.9rem;
  border-top-color: rgba(196, 107, 26, 0.85);
  border-right-color: transparent;
  animation: app-loader-spin 2.2s linear infinite;
}
.app-loader-wave {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 2.1rem;
  height: 0.55rem;
  margin-left: -1.05rem;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(10, 124, 118, 0.55), transparent);
  animation: app-loader-wave 1.4s ease-in-out infinite;
}
.app-loader-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ocean-deep);
}
.app-loader-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--ink);
  margin: 0 0 0.25rem;
}
.app-loader-message {
  margin: 0 0 0.95rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.4;
}
.app-loader-track {
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(12, 26, 40, 0.08);
  overflow: hidden;
}
.app-loader-bar {
  display: block;
  height: 100%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ocean-deep), var(--teal), #14b8a6);
  animation: app-loader-bar 1.15s var(--ease-out) infinite;
}
@keyframes app-loader-spin {
  to { transform: rotate(360deg); }
}
@keyframes app-loader-wave {
  0%, 100% { transform: scaleX(0.7); opacity: 0.45; }
  50% { transform: scaleX(1.15); opacity: 1; }
}
@keyframes app-loader-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
@media (prefers-reduced-motion: reduce) {
  .app-loader-ring-a,
  .app-loader-ring-b,
  .app-loader-ring-c,
  .app-loader-wave,
  .app-loader-bar {
    animation: none;
  }
  .app-loader-ring-a {
    border-color: var(--ocean);
  }
  .app-loader-bar {
    width: 100%;
    transform: none;
    opacity: 0.7;
  }
}


/* ===== Customer find (topbar) + desk UI tighten ===== */
.topbar-slim {
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}
.customer-find {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 12rem;
  max-width: 22rem;
  flex: 1 1 14rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(13, 27, 42, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.75rem 0.15rem 0.65rem;
  box-shadow: inset 0 1px 2px rgba(13, 27, 42, 0.03);
}
.customer-find-icon {
  display: inline-flex;
  color: var(--ink-soft);
  opacity: 0.7;
  flex-shrink: 0;
}
.customer-find-icon .ui-icon { width: 1rem; height: 1rem; }
.customer-find-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.45rem 0.35rem !important;
  min-width: 0;
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
}
.customer-find-input:focus {
  outline: none;
}
.customer-find-suggest {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.4rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.1);
  box-shadow: 0 14px 36px rgba(13, 27, 42, 0.12);
}
.customer-find-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  font: inherit;
}
.customer-find-option:hover,
.customer-find-option.is-active {
  background: rgba(11, 110, 106, 0.1);
}
.customer-find-option strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.customer-find-option small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

/* Contain horizontal scroll to tables / chip rows — never the page */
.main,
.app-detail-layout,
.app-detail-main,
.lams-detail-layout,
.panel,
.acc-panel {
  max-width: 100%;
  min-width: 0;
}
.workspace-nav-sticky,
.workspace-nav {
  max-width: 100%;
  overflow: visible;
  flex-wrap: wrap;
}
.workspace-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}
.workspace-chip {
  flex: 0 0 auto;
  white-space: nowrap;
}
.table-wrap {
  max-width: 100%;
  min-width: 0;
}
.data-table {
  width: max-content;
  min-width: 100%;
  max-width: none;
}
.page-toolbar,
.lams-detail-toolbar,
.page-actions-bar {
  max-width: 100%;
  min-width: 0;
}
.page-toolbar-actions,
.lams-detail-toolbar .page-toolbar-actions {
  flex-wrap: wrap;
  max-width: 100%;
}

/* Prefer multi-column desk forms (textarea / notes stay full width) */
.entity-form > .form-grid:not(.form-grid-stack),
.acc-panel .form-grid:not(.form-grid-stack),
.action-block .form-grid:not(.form-grid-stack),
.form-shell .form-grid:not(.form-grid-stack),
.form-panel .form-grid:not(.form-grid-stack),
.panel-pad > .form-grid:not(.form-grid-stack),
.filter-bar + .form-grid:not(.form-grid-stack) {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.95rem 1.15rem;
}
.entity-form > .form-grid.form-grid-dense,
.acc-panel .form-grid.form-grid-dense,
.action-block .form-grid.form-grid-dense,
.form-shell .form-grid.form-grid-dense,
.form-panel .form-grid.form-grid-dense,
.panel-pad > .form-grid.form-grid-dense {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.8rem 1rem;
}
@media (min-width: 960px) {
  .entity-form > .form-grid.form-grid-dense,
  .acc-panel .form-grid.form-grid-dense,
  .action-block .form-grid.form-grid-dense,
  .form-shell .form-grid.form-grid-dense,
  .form-panel .form-grid.form-grid-dense,
  .panel-pad > .form-grid.form-grid-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 1200px) {
  .entity-form > .form-grid:not(.form-grid-stack):not(.form-grid-dense),
  .form-shell .form-grid:not(.form-grid-stack):not(.form-grid-dense),
  .form-panel .form-grid:not(.form-grid-stack):not(.form-grid-dense) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 720px) {
  .entity-form > .form-grid:not(.form-grid-stack),
  .acc-panel .form-grid:not(.form-grid-stack),
  .action-block .form-grid:not(.form-grid-stack),
  .form-shell .form-grid:not(.form-grid-stack),
  .form-panel .form-grid:not(.form-grid-stack) {
    grid-template-columns: 1fr !important;
  }
}
/* Side desks are ~320px. A 2- or 3-column grid there collapses searchable
   selects to the clear button and caret. Keep every rail form on one column. */
.app-detail-aside .form-grid,
.app-detail-aside .form-grid.form-grid-dense,
.app-detail-aside .entity-form > .form-grid,
.app-detail-aside .entity-form > .form-grid.form-grid-dense,
.app-detail-aside .action-block .form-grid,
.app-detail-aside .action-block .form-grid.form-grid-dense,
.app-detail-aside .panel-pad > .form-grid,
.officer-rail .form-grid,
.officer-rail .form-grid.form-grid-dense,
.officer-rail .entity-form > .form-grid,
.officer-rail .action-block .form-grid,
.officer-rail .action-block .form-grid.form-grid-dense,
.action-modal-body .form-grid,
.action-modal-body .form-grid.form-grid-dense,
.action-modal-panel .form-grid,
.action-modal-panel .form-grid.form-grid-dense {
  grid-template-columns: 1fr !important;
}
.form-field:has(textarea),
.form-grid .form-field.span-2,
.form-grid.form-grid-dense .form-field.span-2 {
  grid-column: 1 / -1 !important;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}
.section-toolbar .section-subtitle {
  margin: 0;
}
.inline-add-form {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px dashed #c5d0d4;
  border-radius: 10px;
  background: #f7fbfb;
}
.inline-add-form[hidden] {
  display: none !important;
}
.table-add-row td {
  background: #f7fbfb;
  border-top: 1px dashed #c5d0d4;
}
.table-add-row .btn {
  min-width: 5.5rem;
}
.var-chip-block {
  margin: 0.5rem 0 1rem;
}
.var-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.35rem 0;
}
.var-chip-row .chip {
  border: 1px solid #c5d0d4;
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.var-chip-row .chip code {
  margin-left: 0.25rem;
  color: #0a7c76;
}
.var-chip-row .chip:hover {
  border-color: #0a7c76;
  background: #f3fbfa;
}
.upload-hint.is-error { color: #b42318; }
.upload-hint.is-warning { color: #b54708; }
.setup-guide {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid #d7e3e4;
  border-radius: 10px;
  background: #f7fbfb;
}
.setup-guide .detail-grid { margin: 0.4rem 0 0; }

/* Page never scrolls sideways — only tables / chip rows */
.page-body,
.main > .page-body,
.filter-bar,
.filter-bar-rich,
.facility-journey,
.lams-kpi-grid,
.attn-strip,
.callout {
  max-width: 100%;
  min-width: 0;
}
.page-body {
  overflow-x: clip;
}
.facility-journey {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.facility-journey-list {
  flex-wrap: nowrap;
  width: max-content;
  min-width: min(100%, max-content);
}
.filter-bar,
.filter-bar-rich {
  flex-wrap: wrap;
}
.table-wrap.is-scroll-end {
  box-shadow: inset -22px 0 18px -12px rgba(13, 27, 42, 0.28);
}
.table-wrap.is-scroll-start {
  box-shadow: inset 22px 0 18px -12px rgba(13, 27, 42, 0.28);
}
.table-wrap.is-scroll-start.is-scroll-end {
  box-shadow:
    inset 22px 0 18px -12px rgba(13, 27, 42, 0.28),
    inset -22px 0 18px -12px rgba(13, 27, 42, 0.28);
}
.data-table-compact thead th {
  white-space: nowrap;
}
.data-table-compact tbody td {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.data-table-compact .col-actions,
.data-table-compact .num,
.data-table-compact th.col-actions,
.data-table-compact td.col-actions,
.data-table-compact .btn,
.data-table-compact .inline-actions {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}
.data-table .col-text {
  min-width: 12rem;
  max-width: 20rem;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.table-wrap {
  max-height: min(38rem, calc(100vh - 11rem));
  overflow: auto;
}
.data-table-compact .empty-state,
.data-table .empty-state {
  white-space: normal;
}
.officer-rail-shell::-webkit-scrollbar,
.history-panel-scroll::-webkit-scrollbar,
.workspace-nav-sticky::-webkit-scrollbar,
.flow-track-window::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.officer-rail-shell::-webkit-scrollbar-thumb,
.history-panel-scroll::-webkit-scrollbar-thumb,
.workspace-nav-sticky::-webkit-scrollbar-thumb,
.flow-track-window::-webkit-scrollbar-thumb {
  background: rgba(12, 26, 40, 0.3);
  border-radius: 999px;
}

/* Wrap at word boundaries only — never split a word mid-character. */
body.app-body,
body.app-body p,
body.app-body li,
body.app-body td,
body.app-body th,
body.app-body h1,
body.app-body h2,
body.app-body h3,
body.app-body label,
body.app-body .panel,
body.app-body .acc-panel {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  -webkit-hyphens: none;
}
body.app-body h1,
body.app-body h2,
body.app-body h3 {
  text-wrap: balance;
}

/* Light workspace chrome — readable left nav on white/teal, not navy. */
.sidebar {
  background: linear-gradient(180deg, #f7fbfb 0%, #eef4f6 100%) !important;
  color: #16324a !important;
}
.sidebar .brand-mark,
.sidebar .brand-sub,
.sidebar .nav-section-label,
.sidebar .nav-text strong,
.sidebar .nav-text small,
.sidebar .nav-list > .nav-group > a.nav-link,
.sidebar .nav-list > .nav-group > button.nav-link,
.sidebar .nav-sub-parent,
.sidebar .nav-sub-link {
  color: #16324a !important;
}
.sidebar .nav-text small,
.sidebar .brand-sub,
.sidebar .nav-section-label {
  color: #5b6b82 !important;
}
.sidebar .nav-list a:hover,
.sidebar .nav-sub-link:hover,
.sidebar .nav-sub-parent:hover {
  background: #e7f5f3 !important;
  color: #0a7c76 !important;
  box-shadow: inset 3px 0 0 #0a7c76 !important;
}
.sidebar .nav-list > .nav-group > a.is-active,
.sidebar .nav-link.is-active,
.sidebar .nav-group.is-open > .nav-parent {
  background: #e7f5f3 !important;
  color: #065a56 !important;
  box-shadow: inset 3px 0 0 #f37e20 !important;
}
.sidebar .nav-sub-link.is-active,
.sidebar .nav-sub a.nav-sub-link.is-active {
  background: #d8efec !important;
  color: #065a56 !important;
  box-shadow: inset 3px 0 0 #f37e20 !important;
}
.sidebar .nav-sub {
  border-left-color: rgba(10, 124, 118, 0.22) !important;
}
.sidebar .nav-sub-link::before {
  background: rgba(10, 124, 118, 0.35) !important;
}
.sidebar .nav-sub-link.is-active::before {
  background: #f37e20 !important;
  box-shadow: none !important;
}
.sidebar .nav-icon {
  background: #e7f5f3 !important;
  color: #0a7c76 !important;
  box-shadow: none !important;
}
.sidebar .nav-list a.is-active .nav-icon,
.sidebar .nav-link.is-active .nav-icon,
.sidebar .nav-group.is-open > .nav-parent .nav-icon {
  background: #0a7c76 !important;
  color: #fff !important;
}

/* Public CMS site styles live in static/css/public.css */

/* ===== Responsive shell: tablet + phone (staff, portal, vendor) ===== */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-toggle span:not(.sr-only) {
  display: block;
  height: 2px;
  width: 100%;
  background: #16324a;
  border-radius: 99px;
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(12, 26, 40, 0.38);
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    height: 100vh;
    min-width: 280px;
    max-width: min(280px, 86vw);
    transform: translateX(-110%);
    transition: transform 200ms var(--ease-out);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop {
    display: block;
  }
  .sidebar-toggle { display: inline-flex; }
  .main { padding: 0.85rem 1rem 2rem; }
  .page-actions-bar,
  .page-toolbar,
  .page-toolbar-rich {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .page-hero-actions,
  .page-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .customer-find { max-width: 14rem; }
  .profile-meta small { display: none; }
}

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.65rem;
  }
  .topbar-meta {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .customer-find { display: none; }
  .profile-meta { display: none; }
  .stat-grid,
  .split,
  .detail-grid,
  .form-grid,
  .form-shell .form-grid,
  .form-panel .form-grid,
  .portal-grid,
  .module-grid,
  .menu-grid { grid-template-columns: 1fr !important; }
  .page-body { gap: 0.85rem; }
  .panel-pad { padding: 0.95rem; }
  .flow-track-window { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table { min-width: 36rem; }
  .btn { min-height: 2.5rem; }
}

@media (max-width: 480px) {
  .main { padding: 0.65rem 0.7rem 1.6rem; }
  .brand-sub { display: none; }
  .breadcrumbs { font-size: 0.82rem; }
  .flow-track-window { grid-template-columns: 1fr; }
}

/* Vendor / customer portal: never show staff external desks */
body.is-portal-user .nav-staff-external {
  display: none !important;
}

.list-reason {
  position: relative;
  display: block;
  max-width: 14rem;
  margin-top: 0.22rem;
  color: var(--rose);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}
.list-reason:hover,
.list-reason:focus {
  overflow: visible;
  white-space: normal;
  z-index: 8;
}
.list-reason:hover::after,
.list-reason:focus::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 12;
  min-width: 12rem;
  max-width: 22rem;
  padding: 0.45rem 0.6rem;
  background: #1b2a4a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 550;
  line-height: 1.35;
  white-space: normal;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(12, 26, 40, 0.18);
}

html:has(body.is-embed-preview) {
  height: auto;
  overflow: auto;
  background: #fff;
}
body.app-body.is-embed-preview {
  height: auto;
  min-height: 100%;
  overflow: auto;
  background: #fff;
  background-image: none;
}
body.is-embed-preview .app-shell {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
}
body.is-embed-preview .main {
  padding: 0;
  min-width: 0;
}
body.is-embed-preview .page-body {
  padding: 0.85rem 1rem 1.2rem;
  animation: none;
}
body.is-embed-preview .print-toolbar,
body.is-embed-preview .app-loader {
  display: none !important;
}
body.is-embed-preview .letter-sheet {
  max-width: none;
  margin: 0;
  padding: 0.35rem 0.15rem 0.8rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ===== Message preview (WhatsApp / SMS / in-app / email phone frame) ===== */
.msg-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 3160;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.msg-preview-modal[hidden] { display: none !important; }
.msg-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 34, 0.58);
  backdrop-filter: blur(2px);
}
.msg-preview-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(13, 27, 42, 0.12);
  box-shadow: 0 28px 56px rgba(10, 22, 34, 0.32);
  animation: rise 160ms ease;
  overflow: hidden;
}
.msg-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.msg-preview-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.msg-preview-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  padding: 1.1rem 1.2rem 1.3rem;
  overflow: auto;
  align-items: start;
}
.msg-preview-meta h3 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.05rem;
}
.msg-preview-kicker {
  margin: 0;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ocean);
}
.msg-preview-meta .mono { font-size: 0.82rem; }
body.msg-preview-open { overflow: hidden; }

.msg-phone {
  width: 260px;
  justify-self: center;
}
.msg-phone-bezel {
  background: #12171c;
  border-radius: 32px;
  padding: 10px 8px 14px;
  box-shadow: 0 18px 36px rgba(12, 26, 40, 0.28);
}
.msg-phone-notch {
  width: 88px;
  height: 8px;
  margin: 2px auto 8px;
  background: #2a3238;
  border-radius: 8px;
}
.msg-phone-screen {
  height: 470px;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #ece5dd;
}
.msg-phone-status {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem 0.2rem;
  color: #fff;
  background: #075e54;
}
.msg-phone-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.65rem 0.55rem;
  background: #075e54;
  color: #fff;
}
.msg-phone-back { font-size: 1.2rem; line-height: 1; opacity: .85; }
.msg-phone-header strong { display: block; font-size: 0.82rem; }
.msg-phone-header small { display: block; font-size: 0.65rem; opacity: .8; }
.msg-phone-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.7rem 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.45rem;
}
.msg-bubble {
  max-width: 92%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px 8px 8px 2px;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  color: #111;
  box-shadow: 0 1px 0 rgba(12, 26, 40, 0.08);
}
.msg-bubble-subject {
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}
.msg-bubble-time {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.62rem;
  opacity: .65;
  text-align: right;
}

.msg-phone[data-channel="WHATSAPP"] .msg-phone-screen { background: #e5ddd5; }
.msg-phone[data-channel="WHATSAPP"] .msg-bubble {
  align-self: flex-start;
  background: #fff;
  border-radius: 0 8px 8px 8px;
}
.msg-phone[data-channel="WHATSAPP"] .msg-bubble.is-out {
  align-self: flex-end;
  background: #dcf8c6;
  border-radius: 8px 0 8px 8px;
}

.msg-phone[data-channel="SMS"] .msg-phone-status,
.msg-phone[data-channel="SMS"] .msg-phone-header {
  background: #f4f4f6;
  color: #111;
}
.msg-phone[data-channel="SMS"] .msg-phone-screen { background: #fff; }
.msg-phone[data-channel="SMS"] .msg-bubble {
  align-self: flex-start;
  background: #e9e9eb;
  border-radius: 16px;
  padding: 0.55rem 0.7rem;
}

.msg-phone[data-channel="INAPP"] .msg-phone-status,
.msg-phone[data-channel="INAPP"] .msg-phone-header {
  background: #065a56;
  color: #fff;
}
.msg-phone[data-channel="INAPP"] .msg-phone-screen { background: #eef5f5; }
.msg-phone[data-channel="INAPP"] .msg-bubble {
  align-self: stretch;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(10, 124, 118, 0.18);
  box-shadow: 0 8px 18px rgba(12, 26, 40, 0.08);
}

.msg-phone[data-channel="EMAIL"] .msg-phone-status,
.msg-phone[data-channel="EMAIL"] .msg-phone-header {
  background: #1b2a4a;
  color: #fff;
}
.msg-phone[data-channel="EMAIL"] .msg-phone-screen { background: #f6f7f9; }
.msg-phone[data-channel="EMAIL"] .msg-bubble {
  align-self: stretch;
  max-width: 100%;
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(12, 26, 40, 0.1);
}

@media (max-width: 700px) {
  .msg-preview-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* Fit tables (notification templates): no horizontal scroll, ellipsis + click popup */
.table-wrap-fit {
  overflow-x: hidden;
}
.table-wrap-fit .data-table-fit,
.data-table-fit {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}
.data-table-fit th,
.data-table-fit td {
  overflow: hidden;
  vertical-align: middle;
}
.data-table-fit .col-code { width: 18%; }
.data-table-fit .col-channel { width: 12%; }
.data-table-fit .col-status { width: 9%; }
.data-table-fit .col-preview,
.data-table-fit th.col-preview,
.data-table-fit td.col-preview {
  width: 7.6rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}
.data-table-fit .cell-code a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-clip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cell-clip:hover,
.cell-clip:focus {
  color: var(--ocean-deep);
  text-decoration: underline;
  outline: none;
}
.cell-clip-short {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-clip-modal {
  position: fixed;
  inset: 0;
  z-index: 3170;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.cell-clip-modal[hidden] { display: none !important; }
.cell-clip-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 34, 0.5);
}
.cell-clip-panel {
  position: relative;
  z-index: 1;
  width: min(36rem, 100%);
  max-height: 80vh;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(13, 27, 42, 0.12);
  box-shadow: 0 24px 48px rgba(10, 22, 34, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cell-clip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.cell-clip-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.cell-clip-body {
  padding: 1rem 1.1rem 1.2rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow: auto;
}
body.cell-clip-open { overflow: hidden; }
