:root {
  --navy-950: #081c30;
  --navy-900: #0a2744;
  --navy-800: #103860;
  --navy-700: #185880;
  --navy-600: #2078a8;
  --gold-700: #c9a22e;
  --gold-600: #d8b445;
  --gold-500: #e8c85c;
  --gold-400: #f3d76e;
  --gold-300: #fae48c;
  --charcoal: #181d23;
  --bg: #f3f6fa;
  --card: #ffffff;
  --text: #101828;
  --muted: #2f4054;
  --border: #c5d0dc;
  --sidebar-w: 268px;
  --sidebar-collapsed-w: 76px;
  --topbar-h: 64px;
  --shadow: 0 8px 24px rgba(16, 56, 96, 0.07);
  --radius: 14px;
  --card-gap: 16px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* Type scale — display headings must be >= --text-body; kickers/labels stay smaller */
  --text-body: 15px;
  --h1: 1.65rem;
  --h2: 1.25rem;
  --h3: 1.1rem;
  --h4: 1.05rem;
  --h5: 1rem;
  --h6: 1rem;
  --text-kicker: 11px;
  --text-label: 12px;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-height: 100%; }
img { max-width: 100%; height: auto; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  letter-spacing: -0.011em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.page-head h1,
.kpi .value,
.sidebar-brand .brand-text strong {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.03em;
}
h1, .h1 { font-size: var(--h1); }
h2, .h2 { font-size: var(--h2); }
h3, .h3 { font-size: var(--h3); }
h4, .h4 { font-size: var(--h4); }
h5, .h5 { font-size: var(--h5); }
h6, .h6 { font-size: var(--h6); }

body.theme-dark,
html.theme-dark body {
  --bg: #12171d;
  --card: #1b222b;
  --text: #eef3f8;
  --muted: #c5d0da;
  --border: #2a3440;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
html.theme-dark {
  color-scheme: dark;
}

a { color: var(--navy-700); text-decoration: none; }
.theme-dark a:not(.btn):not(.icon-btn):not(.nav-link):not(.page-link):not(.dropdown-item):not(.dash-chip):not(.dash-kpi):not(.rpt-card):not(.gs-item):not(.gs-more):not(.sidebar-brand):not(.sort-link):not(.user-chip):not(.integration-card):not(.integration-card-main):not(.settings-subtab):not(.settings-tab) {
  color: var(--gold-400);
}
a:not(.btn):hover { color: var(--navy-800); }

html, body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
.app-shell { min-height: 100%; }
.sidebar {
  --sb-bg: linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
  --sb-text: #081c30;
  --sb-muted: #3d4f63;
  --sb-link: #0a2744;
  --sb-hover: rgba(16, 56, 96, 0.1);
  --sb-active: rgba(200, 168, 80, 0.28);
  --sb-border: rgba(16, 56, 96, 0.12);
  --sb-icon: #103860;
  --sb-scroll: rgba(16, 56, 96, 0.28);
  --sb-label: #3d4f63;
  --sb-shadow: 8px 0 24px rgba(16, 56, 96, 0.06);
  width: var(--sidebar-w);
  background: var(--sb-bg);
  color: var(--sb-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: width .22s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: var(--sb-shadow);
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.theme-dark .sidebar {
  --sb-bg: linear-gradient(180deg, #081c30 0%, #103860 100%);
  --sb-text: #f0f5fa;
  --sb-muted: #c5d0dc;
  --sb-link: #e8eef4;
  --sb-hover: rgba(232, 200, 92, 0.16);
  --sb-active: rgba(232, 200, 92, 0.26);
  --sb-border: rgba(232, 200, 92, 0.22);
  --sb-icon: #f3d76e;
  --sb-scroll: rgba(232, 200, 92, 0.5);
  --sb-label: #d7e2ec;
  --sb-shadow: 8px 0 28px rgba(0, 0, 0, 0.28);
}
.sidebar-brand {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-brand:hover { color: inherit; }
.sidebar-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(200, 168, 80, 0.4), 0 8px 18px rgba(16, 56, 96, 0.12);
}
.sidebar-brand .brand-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  line-height: 1;
}
.sidebar-brand .brand-text strong {
  display: block;
  color: var(--navy-800);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
  padding: 0;
}
.theme-dark .sidebar-brand .brand-text strong { color: #fff; }
.sidebar-brand .brand-text span {
  display: block;
  color: var(--gold-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
  line-height: 1;
  margin: 0;
  padding: 0;
}
.theme-dark .sidebar-brand .brand-text span { color: var(--gold-400); }
.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 20px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -ms-overflow-style: auto;
}
.sidebar-nav:hover,
.sidebar-nav:focus-within {
  scrollbar-color: var(--sb-scroll) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 99px;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-nav:focus-within::-webkit-scrollbar-thumb {
  background: var(--sb-scroll);
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--gold-500); }
.nav-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sb-label);
  padding: 16px 12px 6px;
}
.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sb-link);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  position: relative;
}
.sidebar a.nav-link i {
  width: 20px;
  color: var(--sb-icon);
  font-size: 16px;
  flex-shrink: 0;
  font-weight: 700;
  -webkit-text-stroke: 0.35px currentColor;
}
.sidebar a.nav-link:hover,
.sidebar a.nav-link.active {
  background: var(--sb-hover);
  color: var(--sb-text);
}
.sidebar a.nav-link:hover i,
.sidebar a.nav-link.active i {
  color: var(--navy-800);
}
.theme-dark .sidebar a.nav-link:hover,
.theme-dark .sidebar a.nav-link.active {
  color: #fff;
}
.theme-dark .sidebar a.nav-link:hover i,
.theme-dark .sidebar a.nav-link.active i {
  color: var(--gold-300);
}
.sidebar a.nav-link.active {
  background: var(--sb-active);
  box-shadow: inset 3px 0 0 var(--gold-600);
  font-weight: 700;
}
.sidebar a.nav-link .nav-text { white-space: nowrap; }
.sidebar-collapse {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 22px;
  border: 0;
  border-top: 1px solid var(--sb-border);
  border-radius: 0;
  background: transparent;
  color: var(--sb-link);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sidebar-collapse i { width: 18px; color: var(--sb-icon); }
.sidebar-collapse:hover { background: var(--sb-hover); color: var(--sb-text); }

.sidebar-tip {
  position: fixed;
  z-index: 80;
  display: none;
  align-items: center;
  gap: 0;
  padding: 7px 12px;
  background: #103860;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-radius: 8px;
  border: 1px solid rgba(200, 168, 80, 0.45);
  box-shadow: 0 10px 24px rgba(16, 56, 96, 0.28);
  pointer-events: none;
  white-space: nowrap;
}
.sidebar-tip::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #103860;
  border-left: 1px solid rgba(200, 168, 80, 0.45);
  border-bottom: 1px solid rgba(200, 168, 80, 0.45);
  transform: translateY(-50%) rotate(45deg);
}
.theme-dark .sidebar-tip {
  background: #0a2744;
  color: #fff;
}

.main {
  margin-left: var(--sidebar-w);
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: auto;
  position: relative;
  z-index: 1;
  transition: margin-left .2s ease;
  display: flex;
  flex-direction: column;
}
.sidebar-backdrop {
  display: none;
}
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: visible;
  flex: 0 0 auto;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-now {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-now-clock {
  line-height: 1.15;
  white-space: nowrap;
}
.topbar-now-clock strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--navy-800);
}
.theme-dark .topbar-now-clock strong { color: #fff; }
.topbar-now-clock span {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}
.topbar-now-weather {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(16, 56, 96, 0.06);
  border: 1px solid var(--border);
  color: var(--navy-800);
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
}
.topbar-now-weather.is-empty { display: none; }
.theme-dark .topbar-now-weather {
  background: rgba(255, 255, 255, 0.05);
  color: #eef3f8;
}
.topbar-now-weather i {
  color: var(--gold-600);
  font-size: 1.05rem;
}
.topbar-now-weather small {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
}
@media (max-width: 1100px) {
  .topbar-now-weather small { display: none; }
}
@media (max-width: 760px) {
  .topbar-now-weather { display: none; }
  .topbar-now-clock span { display: none; }
}
.topbar-search {
  display: none;
  position: relative;
  width: 100%;
  max-width: 560px;
}
.icon-btn.topbar-search-btn { display: none; }
@media (min-width: 992px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 560px) minmax(0, 1fr);
    align-items: center;
  }
  .topbar-left { justify-self: start; }
  .topbar-search { display: block; justify-self: center; max-width: none; }
  .topbar-actions { justify-self: end; }
  .icon-btn.topbar-search-btn { display: none !important; }
}
.topbar-search input {
  width: 100%;
  border: 1.5px solid #b7c4d1;
  background: #eef3f8;
  color: var(--navy-800);
  border-radius: 999px;
  padding: 9px 16px 9px 40px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
}
.theme-dark .topbar-search input {
  background: #12181f;
  border-color: #3d4c5c;
  color: #eef3f8;
}
.theme-dark .topbar-search input::placeholder {
  color: #c5d0dc;
  opacity: 1;
}
.topbar-search i {
  position: absolute;
  left: 14px;
  top: 10px;
  color: var(--muted);
}
.theme-dark .topbar-search i {
  color: #d0b058;
}
.topbar-search #globalSearchResults {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  max-height: min(70vh, 480px);
  overflow: auto;
  padding: 6px 0 8px;
  border-radius: 14px;
}
.topbar-search #globalSearchResults.is-open { display: block; }
.gs-group + .gs-group { border-top: 1px solid var(--border); }
.gs-head {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.gs-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 14px;
  color: inherit;
  text-decoration: none;
}
.gs-item:hover { background: rgba(16, 56, 96, 0.05); color: inherit; }
.theme-dark .gs-item:hover { background: rgba(200, 168, 80, 0.08); }
.gs-item strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .gs-item strong { color: #fff; }
.gs-item small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.gs-more {
  display: block;
  text-align: center;
  padding: 10px 14px 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .gs-more { color: var(--gold-400); }
.gs-empty {
  padding: 18px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.search-page-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: 760px;
}
.search-page-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  display: flex;
}
.search-page-field > i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8fa3;
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 1;
}
.search-page-field .form-control {
  width: 100%;
  min-height: 48px;
  height: 48px;
  padding: 0 18px 0 46px;
  border-radius: 14px;
  border: 1px solid rgba(16, 56, 96, 0.12);
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 56, 96, 0.06);
  font-size: 15px;
  font-weight: 600;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-page-field .form-control::placeholder {
  color: #8a9aab;
  font-weight: 500;
}
.search-page-field .form-control:hover {
  border-color: rgba(16, 56, 96, 0.22);
}
.search-page-field .form-control:focus {
  border-color: rgba(200, 168, 80, 0.7);
  box-shadow: 0 0 0 3px rgba(200, 168, 80, 0.22), 0 12px 28px rgba(16, 56, 96, 0.08);
  background: #fff;
}
.search-page-submit {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(16, 56, 96, 0.18);
}
.search-page-submit i { font-size: 0.95rem; line-height: 1; }
.theme-dark .search-page-field .form-control {
  background: #151c24;
  border-color: #3d4c5c;
  box-shadow: none;
  color: #f2f4f7;
}
.theme-dark .search-page-field .form-control:focus {
  border-color: rgba(200, 168, 80, 0.55);
  box-shadow: 0 0 0 3px rgba(200, 168, 80, 0.18);
}
@media (max-width: 560px) {
  .search-page-form {
    flex-direction: column;
  }
  .search-page-submit {
    width: 100%;
  }
}
.topbar-actions { display: flex; align-items: center; gap: 12px; position: relative; z-index: 50; flex-shrink: 0; }
.topbar-actions .dropdown { position: relative; }
.dropdown-menu { display: none; }
.dropdown-menu.show { display: block; }
.notify-menu {
  width: 320px;
  max-width: calc(100vw - 24px);
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  left: auto !important;
  transform: none !important;
  z-index: 60;
}
.topbar-actions .dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none !important;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--navy-800);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  flex-shrink: 0;
  touch-action: manipulation;
}
.theme-dark .icon-btn { color: var(--gold-400); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-500);
}
.notify-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c45c4a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}
.notify-count.is-zero { display: none; }
.notify-menu .dropdown-item { white-space: normal; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.user-chip strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  padding: 0;
}
.user-chip-copy {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  line-height: 1;
  text-align: left;
}
@media (min-width: 992px) {
  .user-chip-copy { display: flex; }
}
.user-chip-copy small {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  line-height: 1;
  margin: 0;
  padding: 0;
}
.user-chip .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy-800); color: var(--gold-400);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  object-fit: cover;
}

.content { padding: 22px; flex: 1 0 auto; min-width: 0; }
.statement-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.statement-filter .form-control {
  width: auto;
  min-width: min(160px, 100%);
  flex: 1;
}
.app-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 22px 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.app-footer span + span::before {
  content: "·";
  margin-right: 8px;
  color: var(--gold-600);
}
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 20px;
}
.page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-head h1 { font-size: 1.65rem; margin: 0 0 4px; color: var(--navy-800); overflow-wrap: anywhere; }
.page-head-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 4px;
}
.page-head-heading h1 { margin: 0; }
.page-guide-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--navy-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.05rem;
  cursor: pointer;
  flex: 0 0 auto;
}
.theme-dark .page-guide-btn {
  color: #f3d76e !important;
  border-color: #4a5a6c !important;
  background: #2a3644 !important;
  box-shadow: 0 0 0 1px rgba(243, 215, 110, 0.15);
}
.page-guide-btn:hover,
.page-guide-btn.is-open {
  border-color: var(--gold-600);
  color: var(--gold-600);
  background: rgba(232, 200, 92, 0.12);
}
.theme-dark .page-guide-btn:hover,
.theme-dark .page-guide-btn.is-open {
  color: #fae48c !important;
  border-color: var(--gold-500) !important;
  background: rgba(232, 200, 92, 0.22) !important;
}
.page-guide-panel {
  position: absolute;
  z-index: 80;
  width: min(440px, calc(100vw - 32px));
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 16px 18px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 16px 40px rgba(16, 56, 96, 0.16);
}
.theme-dark .page-guide-panel { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.page-guide-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.page-guide-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-600);
}
.page-guide-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy-800);
}
.theme-dark .page-guide-head h2 { color: #fff; }
.page-guide-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
}
.page-guide-intro {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.page-guide-block {
  margin: 0 0 12px;
}
.page-guide-block h3 {
  margin: 0 0 4px;
  font-size: var(--text-kicker);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--gold-600);
}
.page-guide-block p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--navy-800);
}
.theme-dark .page-guide-block p { color: #e8eef5; }
.page-guide-example {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(16, 56, 96, 0.04);
}
.theme-dark .page-guide-example { background: rgba(255, 255, 255, 0.04); }
.page-guide-flow,
.page-guide-features {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
}
.page-guide-flow li,
.page-guide-features li { margin: 0 0 8px; }
.page-guide-features strong { display: block; color: var(--navy-800); }
.theme-dark .page-guide-features strong { color: #fff; }
.page-guide-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-800);
}
.theme-dark .page-guide-more { color: var(--gold-600); }
.theme-dark .page-guide-flow,
.theme-dark .page-guide-features,
.theme-dark .page-guide-flow li,
.theme-dark .page-guide-features li {
  color: #e8eef5;
}

.manual-print-brand { display: none; }
.manual-print-prepared {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-800);
}
.manual-print-flow {
  width: 100%;
  min-width: 0;
}
.manual-print-sheet {
  box-shadow: none;
  border: 0;
  background: transparent;
  padding: 0;
}
@media print {
  .manual-print-brand { display: block !important; }
  .manual-layout {
    display: block !important;
    grid-template-columns: none !important;
  }
  .manual-toc { display: none !important; }
  .manual-print-sheet {
    padding: 0 0 calc(8mm + 20px) !important;
  }
  .manual-section.card-soft {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #d7e0ea !important;
    background: #fff !important;
    margin: 0 0 12px !important;
    padding: 12px 14px !important;
    border-radius: 0 !important;
  }
  .manual-print-sheet .doc-logo img {
    height: 46px !important;
    max-width: 220px !important;
  }
}
.manual-layout {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.manual-toc {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 12px);
  padding: 16px 18px;
  max-height: calc(100vh - var(--topbar-h) - env(safe-area-inset-top, 0px) - 32px);
  overflow: auto;
}
.manual-toc h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--navy-800);
}
.theme-dark .manual-toc h2 { color: #fff; }
.manual-toc-group { margin: 0 0 14px; }
.manual-toc-group h3 {
  margin: 0 0 6px;
  font-size: var(--text-kicker);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-600);
}
.manual-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.manual-toc li { margin: 0 0 4px; }
.manual-toc a {
  display: block;
  padding: 4px 0;
  color: var(--navy-800);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}
.theme-dark .manual-toc a { color: #e8eef5; }
.manual-toc a:hover { color: var(--gold-600); }
.manual-body { display: grid; gap: 14px; }
.manual-section {
  padding: 18px 20px;
  scroll-margin-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 16px);
}
.manual-section h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: var(--navy-800);
  border-bottom: 2px solid var(--gold-600);
  padding-bottom: 6px;
}
.theme-dark .manual-section h2 { color: #fff; }
.manual-path {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.manual-intro {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.manual-feature {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 56, 96, 0.03);
}
.theme-dark .manual-feature { background: rgba(255, 255, 255, 0.03); }
.manual-feature h3 {
  margin: 0 0 4px;
  font-size: var(--h6);
  color: var(--navy-800);
}
.theme-dark .manual-feature h3 { color: #fff; }
.manual-feature p {
  margin: 0 0 6px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.manual-feature ol {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.manual-feature li { margin: 0 0 4px; color: inherit; }
/* Manual is wrapped in .doc-sheet for print; keep screen dark mode readable */
.theme-dark .manual-print-sheet.doc-sheet,
.theme-dark .manual-print-sheet {
  background: transparent !important;
  color: var(--text) !important;
}
.theme-dark .manual-body,
.theme-dark .manual-section,
.theme-dark .manual-section.card-soft {
  background: var(--card);
  border-color: var(--border);
  color: var(--text) !important;
}
.theme-dark .manual-feature {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}
.theme-dark .manual-feature p,
.theme-dark .manual-feature ol,
.theme-dark .manual-feature li,
.theme-dark .manual-feature span,
.theme-dark .manual-intro,
.theme-dark .manual-path,
.theme-dark .manual-lead,
.theme-dark .manual-section p,
.theme-dark .manual-section li {
  color: #dce6f0 !important;
}
.theme-dark .manual-toc.card-soft,
.theme-dark .manual-toc {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}
.theme-dark .manual-toc a { color: #e8eef5 !important; }
.theme-dark .manual-toc a:hover { color: var(--gold-400) !important; }
.theme-dark .manual-lead { color: var(--muted) !important; }
@media (max-width: 991.98px) {
  .manual-layout { grid-template-columns: 1fr; }
  .manual-toc {
    position: static;
    max-height: none;
  }
}
.theme-dark .page-head h1 { color: #fff; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ticket-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}
.ticket-status-bar strong {
  display: block;
  color: var(--navy-800);
  font-size: 14px;
}
.ticket-status-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.ticket-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.theme-dark .ticket-status-bar { background: #151c26; }
.theme-dark .ticket-status-bar strong { color: #f2f6fa; }
.page-actions form { display: inline-flex; margin: 0; }

.card-soft {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
a.card-soft {
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card-soft:hover {
  color: inherit;
  border-color: var(--gold-500);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(16, 56, 96, 0.12);
}
.kpi {
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute; right: -12px; top: -12px;
  width: 70px; height: 70px; border-radius: 50%;
  background: rgba(200, 168, 80, 0.12);
}
.kpi .label { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 1.45rem; font-weight: 800; color: var(--navy-800); margin-top: 6px; letter-spacing: -0.03em; }
.theme-dark .kpi .value { color: var(--gold-400); }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.card-soft h6 {
  font-size: var(--h6);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy-800);
  margin-bottom: 12px;
}
.theme-dark .card-soft h6 { color: var(--gold-400); }

/* ——— Buttons ——— */
.btn,
.btn:hover,
.btn:focus,
.btn:focus-visible,
.btn:active,
.btn.active,
.btn:disabled {
  box-shadow: none !important;
}
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  touch-action: manipulation;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.btn i { font-size: 1.05em; line-height: 1; }
.btn:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}
.btn:active:not(:disabled):not(.is-busy) {
  transform: none;
}
.btn.is-busy {
  pointer-events: none;
  opacity: .92;
}
.btn-spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: btn-spin .65s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.btn-sm {
  border-radius: 8px;
  padding: 0.32rem 0.7rem;
  font-size: 12.5px;
  gap: 0.32rem;
}
.btn-gold,
a.btn-gold {
  background: var(--gold-500);
  border-color: #d4b34a;
  color: #1a1408 !important;
  font-weight: 700;
}
.btn-gold:hover, .btn-gold:focus,
a.btn-gold:hover, a.btn-gold:focus {
  background: var(--gold-400);
  border-color: var(--gold-400);
  color: #1a1408 !important;
  filter: none;
}
.btn-gold:active:not(:disabled):not(.is-busy),
a.btn-gold:active:not(:disabled):not(.is-busy) {
  background: #d4b34a;
  border-color: #c9a22e;
  color: #1a1408 !important;
}
.btn-gold:disabled,
.btn-gold.is-busy,
a.btn-gold:disabled,
a.btn-gold.is-busy {
  opacity: 1;
  color: #1a1408 !important;
  filter: none;
  background: var(--gold-500);
}
.btn-navy,
a.btn-navy {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff !important;
}
.btn-navy:hover, .btn-navy:focus,
a.btn-navy:hover, a.btn-navy:focus {
  background: var(--navy-700);
  border-color: var(--navy-700);
  color: #fff !important;
}
.btn-navy:active:not(:disabled):not(.is-busy),
a.btn-navy:active:not(:disabled):not(.is-busy) {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff !important;
}

.btn-view {
  color: var(--navy-800) !important;
  background: #eef3f8;
  border: 1px solid #c5d3e3;
  font-weight: 600;
}
.btn-view:hover, .btn-view:focus {
  background: var(--navy-800);
  color: #fff !important;
  border-color: var(--navy-800);
}
.btn-view:active:not(:disabled):not(.is-busy) {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff !important;
}
.btn-edit {
  color: var(--navy-800) !important;
  background: #fff;
  border: 1px solid #cfd8e3;
  font-weight: 600;
}
.btn-edit:hover, .btn-edit:focus {
  background: var(--navy-800);
  color: #fff !important;
  border-color: var(--navy-800);
}
.btn-edit:active:not(:disabled):not(.is-busy) {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff !important;
}
body.theme-dark a.btn-view,
body.theme-dark .btn-view {
  background: #1c2834 !important;
  color: #f2f6fa !important;
  border-color: #4a5a6c !important;
}
body.theme-dark a.btn-view:hover,
body.theme-dark .btn-view:hover,
body.theme-dark a.btn-view:focus,
body.theme-dark .btn-view:focus {
  background: var(--navy-700) !important;
  color: #fff !important;
  border-color: var(--navy-700) !important;
}
body.theme-dark a.btn-edit,
body.theme-dark .btn-edit {
  background: #24303c !important;
  color: #f2f6fa !important;
  border-color: #4a5a6c !important;
}
body.theme-dark a.btn-edit:hover,
body.theme-dark .btn-edit:hover,
body.theme-dark a.btn-edit:focus,
body.theme-dark .btn-edit:focus {
  background: var(--gold-500) !important;
  color: #1a1a1a !important;
  border-color: var(--gold-500) !important;
}
body.theme-dark a.btn-edit:active,
body.theme-dark .btn-edit:active {
  background: var(--gold-600) !important;
  border-color: var(--gold-600) !important;
  color: #1a1a1a !important;
}
body.theme-dark a.btn-gold,
body.theme-dark .btn-gold {
  color: #1a1a1a !important;
}
body.theme-dark a.btn-navy,
body.theme-dark .btn-navy {
  color: #fff !important;
}

.btn-outline-secondary,
a.btn-outline-secondary {
  color: var(--navy-800) !important;
  border-color: #cfd8e3;
  background: var(--card);
  font-weight: 600;
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus,
a.btn-outline-secondary:hover, a.btn-outline-secondary:focus {
  background: #eef3f8;
  color: var(--navy-800) !important;
  border-color: #9aafc2;
}
.btn-outline-secondary:active:not(:disabled):not(.is-busy) {
  background: #dfe7ef;
  border-color: #8aa0b4;
  color: var(--navy-800);
}
.theme-dark .btn-outline-secondary,
.theme-dark a.btn-outline-secondary {
  color: #d7e2ec !important;
  border-color: #3a4654;
  background: transparent;
}
.theme-dark .btn-outline-secondary:hover,
.theme-dark .btn-outline-secondary:focus,
.theme-dark a.btn-outline-secondary:hover,
.theme-dark a.btn-outline-secondary:focus {
  background: #24303c;
  color: #fff !important;
  border-color: #5a6b7c;
}
.theme-dark .btn-outline-secondary:active {
  background: #1b242e;
  color: #fff;
}

.btn-outline-danger {
  font-weight: 600;
  border-radius: 10px;
  color: #b42318;
  background: var(--card);
  border: 1px solid #e3b4b0;
}
.btn-outline-danger:hover, .btn-outline-danger:focus {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}
.btn-outline-danger:active:not(:disabled):not(.is-busy) {
  background: #8f1c14;
  border-color: #8f1c14;
  color: #fff;
}
.btn-outline-danger.btn-sm { border-radius: 8px; }
.theme-dark .btn-outline-danger {
  color: #f2b8b5;
  background: transparent;
  border-color: #8a3a36;
}
.theme-dark .btn-outline-danger:hover,
.theme-dark .btn-outline-danger:focus {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}

.form-control, .form-select, textarea.form-control {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy-800);
  background: #eef3f8;
  border: 1.5px solid #b7c4d1;
  border-radius: 12px;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
textarea.form-control {
  min-height: 96px;
  font-weight: 600;
  line-height: 1.5;
}
.form-control::placeholder,
.form-select::placeholder {
  color: #7d8d9e;
  font-weight: 500;
  opacity: 1;
}
.form-control:hover, .form-select:hover {
  border-color: #8ea0b3;
  background-color: #fff;
}
.form-control:focus, .form-select:focus {
  background-color: #fff;
  border-color: var(--gold-500);
  color: var(--navy-800);
  box-shadow: 0 0 0 4px rgba(200, 168, 80, 0.22);
}
.form-control:disabled, .form-select:disabled {
  opacity: .65;
  background: #e4eaf1;
  color: #5b6b7c;
}
.password-field {
  position: relative;
  display: block;
}
.password-field > .form-control {
  padding-right: 46px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.password-toggle:hover,
.password-toggle:focus {
  color: var(--navy-800);
  background: rgba(16, 56, 96, 0.08);
  outline: none;
}
.theme-dark .password-toggle { color: #c5d0dc; }
.theme-dark .password-toggle:hover,
.theme-dark .password-toggle:focus {
  color: var(--gold-400);
  background: rgba(232, 200, 92, 0.12);
}
.form-select {
  --bs-form-select-bg-img: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23103860' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px;
  padding-right: 2.2rem;
}
.form-control-sm, .form-select-sm {
  min-height: 36px;
  font-size: 13px;
  padding: 0.32rem 0.7rem;
  border-radius: 10px;
}
.form-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy-800);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.form-hint {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.form-check-input {
  width: 1.1em;
  height: 1.1em;
  border: 1.5px solid #8ea0b3;
  margin-top: 0.2em;
}
.form-check-input:checked {
  background-color: var(--navy-800);
  border-color: var(--navy-800);
}
.form-check-label {
  font-weight: 600;
  color: var(--text);
}
.theme-dark .form-control,
.theme-dark .form-select {
  background-color: #12181f;
  border-color: #3d4c5c;
  color: #eef3f8;
  box-shadow: none;
  color-scheme: dark;
}
.theme-dark .form-control {
  background-image: none;
}
.theme-dark .form-control:hover,
.theme-dark .form-select:hover,
.theme-dark .form-control:focus,
.theme-dark .form-select:focus {
  background-color: #1b222b;
  color: #fff;
}
.theme-dark .form-control::placeholder,
.theme-dark .form-select::placeholder {
  color: #8ea0b3;
  opacity: 1;
}
.theme-dark .form-label { color: #e8eef5; }
.theme-dark .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23c8a850' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px;
}
.theme-dark .form-select:hover,
.theme-dark .form-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23c8a850' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 12px;
}
.theme-dark input[type="date"],
.theme-dark input[type="datetime-local"],
.theme-dark input[type="time"] {
  color-scheme: light;
}
.theme-dark input[type="date"]::-webkit-calendar-picker-indicator,
.theme-dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.theme-dark input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.85);
  opacity: 1;
  cursor: pointer;
}
.theme-dark .table {
  --bs-table-bg: var(--card);
  --bs-table-color: var(--text);
  --bs-table-striped-bg: #151b22;
  --bs-table-hover-bg: rgba(200, 168, 80, 0.06);
  --bs-table-border-color: var(--border);
  color: var(--text);
  background-color: transparent;
}
.theme-dark .table > :not(caption) > * > * {
  background-color: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.theme-dark .table tbody td a:not(.btn) { color: var(--gold-400); }
.text-muted,
.text-secondary,
.text-body-secondary,
.form-text {
  color: #3d4f63 !important;
  font-weight: 600;
}
.form-text {
  font-size: 13px;
}
.theme-dark .text-muted { color: #c5d0da !important; }
.theme-dark .text-secondary,
.theme-dark .text-body-secondary,
.theme-dark .form-text { color: #c5d0da !important; }
.theme-dark .small.text-muted,
.theme-dark small.text-muted { color: #d0dae3 !important; }

.table { font-size: 13.5px; }
.table thead th {
  background: #f7f9fc;
  color: var(--navy-800);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.theme-dark .table thead th { background: #151b22; color: var(--gold-400); }
.table td { vertical-align: middle; }
.table tbody tr:hover { background: rgba(16, 56, 96, 0.035); }
.theme-dark .table tbody tr:hover { background: rgba(200, 168, 80, 0.06); }
.table tbody td a { font-weight: 600; }

.badge {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: 999px;
  padding: .4em .7em;
  font-size: 11px;
}

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
  font-weight: 500;
}
.empty-state i { font-size: 36px; color: var(--gold-500); display: block; margin-bottom: 10px; }
.empty-state strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy-800);
  margin-bottom: 8px;
}
.theme-dark .empty-state strong { color: #fff; }
.empty-state p { margin: 0 auto; max-width: 46ch; }

.pagination .page-link {
  font-family: inherit;
  font-weight: 600;
  color: var(--navy-800);
  background: var(--card);
  border-radius: 8px;
  margin: 0 2px;
  border-color: var(--border);
}
.pagination .page-item.active .page-link {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.theme-dark .pagination .page-link {
  background: #1b222b;
  color: #eef3f8;
  border-color: #3a4654;
}
.theme-dark .pagination .page-item.active .page-link {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: #1a1a1a;
}
.theme-dark .pagination .page-item.disabled .page-link {
  background: transparent;
  color: #6d7f93;
}
.theme-dark .dropdown-menu {
  background: #1b222b;
  border-color: #2a3440;
  color: #eef3f8;
}
.theme-dark .dropdown-item {
  color: #eef3f8;
}
.theme-dark .dropdown-item:hover,
.theme-dark .dropdown-item:focus {
  background: #24303c;
  color: #fff;
}
.theme-dark .btn-link {
  color: var(--gold-400);
}

.toast-stack {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  top: max(12px, env(safe-area-inset-top, 0px));
  z-index: 1080;
  max-width: min(360px, calc(100vw - 24px));
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
}
.app-dialog[hidden] { display: none !important; }
.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 28, 48, 0.55);
  backdrop-filter: blur(6px);
}
.app-dialog-card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 26px 22px;
  box-shadow: 0 28px 64px rgba(8, 28, 48, 0.28);
  text-align: center;
  border: 1px solid rgba(200, 168, 80, 0.22);
  animation: appDialogIn 0.22s ease-out;
}
.app-dialog-card:has([data-dialog-reminder-form]) {
  width: min(480px, 100%);
}
@keyframes appDialogIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.app-dialog-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.65rem;
  background: rgba(16, 56, 96, 0.08);
  color: var(--navy-800);
}
.app-dialog[data-type="success"] .app-dialog-icon {
  background: rgba(25, 135, 84, 0.12);
  color: #157347;
}
.app-dialog[data-type="error"] .app-dialog-icon {
  background: rgba(180, 35, 24, 0.1);
  color: #b42318;
}
.app-dialog[data-type="warning"] .app-dialog-icon {
  background: rgba(200, 168, 80, 0.18);
  color: var(--gold-700);
}
.app-dialog-card h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--navy-800);
}
.app-dialog-card p {
  margin: 0 0 20px;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.5;
}
.app-dialog-extra {
  text-align: left;
  margin: -4px 0 14px;
}
.app-dialog-extra[hidden] { display: none !important; }
.app-dialog-extra .form-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.app-dialog-extra .form-select,
.app-dialog-extra .form-control {
  font-size: 13px;
}
.app-dialog-extra .form-select.is-invalid,
.app-dialog-extra .form-control.is-invalid {
  border-color: #c45c5c;
}
.app-dialog-extra .invalid-feedback {
  display: none;
  font-size: 12px;
  margin-top: 6px;
}
.app-dialog-extra .form-select.is-invalid + .invalid-feedback,
.app-dialog-extra .form-control.is-invalid + .invalid-feedback {
  display: block;
  color: #c45c5c;
}
.app-dialog-extra .dialog-reminder-schedule {
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f9fc;
}
.app-dialog-extra .dialog-reminder-schedule .row {
  --bs-gutter-y: 0.5rem;
}
.app-dialog-extra [data-dialog-reminder-form] > .form-label.mt-2 {
  margin-top: 0.65rem !important;
}
.app-dialog-extra [data-dialog-reminder-form] > p.small {
  margin-top: 0.65rem !important;
}
.theme-dark .app-dialog-extra .dialog-reminder-schedule {
  background: #1a222b;
}
.app-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.app-dialog-actions .btn { min-width: 110px; }
body.app-dialog-open { overflow: hidden; }
.theme-dark .app-dialog-card {
  background: #151c24;
  border-color: #3d4c5c;
}
.theme-dark .app-dialog-card h3 { color: #f2f4f7; }
.theme-dark .app-dialog-card p { color: #c5d0dc; }
/* Dialog icon: navy on dark card is invisible — use gold / status colours */
.theme-dark .app-dialog-icon {
  background: rgba(232, 200, 92, 0.16);
  color: var(--gold-400, #f0d878);
}
.theme-dark .app-dialog[data-type="success"] .app-dialog-icon {
  background: rgba(25, 135, 84, 0.22);
  color: #75b798;
}
.theme-dark .app-dialog[data-type="error"] .app-dialog-icon {
  background: rgba(220, 53, 69, 0.22);
  color: #f1aeb5;
}
.theme-dark .app-dialog[data-type="warning"] .app-dialog-icon {
  background: rgba(232, 200, 92, 0.2);
  color: var(--gold-400, #f0d878);
}
.theme-dark .app-dialog[data-type="info"] .app-dialog-icon,
.theme-dark .app-dialog[data-type="confirm"] .app-dialog-icon {
  background: rgba(232, 200, 92, 0.16);
  color: var(--gold-400, #f0d878);
}

.staff-dep-dialog .staff-dep-card {
  width: min(640px, 100%);
  max-height: min(88vh, 820px);
  text-align: left;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 18px;
}
.staff-dep-dialog .app-dialog-icon { margin-left: 0; }
.staff-dep-dialog .staff-dep-card h3 { text-align: left; }
.staff-dep-dialog .staff-dep-card > p { text-align: left; margin-bottom: 14px; }
.staff-dep-body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding-right: 4px;
}
.staff-dep-empty {
  color: var(--muted);
  font-size: 13px;
}
.staff-dep-group {
  border: 1px solid #e1e8ef;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f7fafc;
}
.theme-dark .staff-dep-group {
  background: #1b242e;
  border-color: #3a4654;
}
.staff-dep-group[data-kind="open"] { border-color: rgba(200, 168, 80, 0.45); }
.staff-dep-group header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.staff-dep-group header span {
  font-weight: 800;
  color: var(--gold-700);
}
.staff-dep-group ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}
.staff-dep-group li { margin: 3px 0; }
.staff-dep-status {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--muted);
}
.staff-dep-more { color: var(--muted); font-style: italic; list-style: none; margin-left: -18px; }
.staff-dep-field { display: block; }
.staff-dep-field span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
}
.staff-dep-warn { color: #b42318; font-size: 13px; margin: 0; }
.staff-dep-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.dep-inline ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.dep-inline li {
  margin: 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.doc-paper { background: #fff; color: #111; padding: 28px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid #103860; padding-bottom: 16px; }
.doc-head h2 { color: #103860; margin: 0; }
.gold-line { height: 4px; background: linear-gradient(90deg, #103860, var(--gold-500)); margin: 12px 0 20px; }

.doc-sheet {
  background: #fff;
  color: #1a2332;
  padding: 28px 32px 18px;
  max-width: none;
  width: 100%;
  min-height: 0;
  font-size: 13px;
  line-height: 1.55;
  display: block;
  overflow-x: hidden;
}
.doc-sheet > .doc-shell {
  width: 100%;
  min-height: 0;
  height: auto;
  border-collapse: collapse;
  display: table;
}
.doc-sheet > .doc-shell > tbody {
  display: table-row-group;
}
.doc-sheet > .doc-shell > tbody > tr.doc-shell-main,
.doc-sheet > .doc-shell > tbody > tr.doc-shell-foot-row {
  display: table-row;
}
.doc-sheet > .doc-shell td.doc-shell-body,
.doc-sheet > .doc-shell td.doc-shell-foot {
  display: table-cell;
  width: 100%;
}
.doc-sheet > .doc-shell td.doc-shell-body {
  vertical-align: top;
}
.doc-sheet > .doc-shell td.doc-shell-foot {
  vertical-align: top;
  padding-top: 16px;
}
.doc-sheet table { width: 100%; border-collapse: collapse; }
.doc-sheet .muted { color: #5b6b7c; }
.doc-sheet .right { text-align: right; }
.doc-sheet .center { text-align: center; }
.doc-sheet .nowrap { white-space: nowrap; }
.doc-sheet .doc-header { table-layout: fixed; width: 100%; }
.doc-sheet .doc-header td { vertical-align: middle; }
.doc-sheet .doc-logo { width: 58%; }
.doc-sheet .doc-logo img { height: 80px; width: auto; max-width: 360px; }
.doc-sheet .doc-title-cell { text-align: right; width: 42%; }
.doc-sheet .doc-kicker {
  color: var(--gold-600);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.doc-sheet .doc-type {
  color: var(--navy-800);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 2px 0 6px;
}
.doc-sheet .doc-number { font-size: 14px; font-weight: 700; color: var(--navy-800); }
.doc-sheet .navy-bar { height: 2px; background: var(--navy-800); margin: 4px 0 0; }
.doc-sheet .gold-bar { height: 3px; background: var(--gold-500); margin: 0 0 10px; }
.doc-sheet .party-table {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.doc-sheet .party-table td {
  width: 50%;
  vertical-align: top;
  background: transparent;
  border: 0;
  padding: 0 0 12px;
  line-height: 1.55;
  font-size: 13.5px;
  font-weight: 600;
  color: #243044;
}
.doc-sheet .party-table td.party-from { padding-right: 28px; }
.doc-sheet .party-table td.party-to { text-align: right; padding-left: 28px; }
.doc-sheet .party-table td > div { margin: 0 0 7px; }
.doc-sheet .party-table td > div:last-child { margin-bottom: 4px; }
.doc-sheet .party-label {
  color: var(--gold-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 10px !important;
}
.doc-sheet .party-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy-800);
  margin: 0 0 8px !important;
  letter-spacing: -.01em;
}
.doc-sheet .party-tagline {
  color: #3d4f63;
  font-weight: 600;
  margin: 0 0 6px;
}
.doc-sheet .meta-table { margin: 18px 0; }
.doc-sheet .meta-table td {
  border: 1px solid var(--border);
  padding: 16px 16px;
  width: 25%;
  vertical-align: top;
}
.doc-sheet .meta-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.doc-sheet .meta-value { font-weight: 700; color: var(--navy-800); }
.doc-sheet .meta-value-terms {
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
}
.doc-sheet .items { table-layout: fixed; width: 100%; }
.doc-sheet .items .col-num { width: 6%; }
.doc-sheet .items .col-desc { width: auto; }
.doc-sheet .items .col-qty { width: 10%; }
.doc-sheet .items .col-price { width: 16%; }
.doc-sheet .items .col-tax { width: 10%; }
.doc-sheet .items .col-amt { width: 16%; }
.doc-sheet .items th {
  background: var(--navy-800);
  color: #fff;
  padding: 14px 16px;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: left;
}
.doc-sheet .items th.r, .doc-sheet .items td.r { text-align: right; }
.doc-sheet .items th.c, .doc-sheet .items td.c { text-align: center; }
.doc-sheet .items td {
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  vertical-align: top;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.doc-sheet .items td.nowrap { overflow-wrap: normal; word-break: normal; }
.doc-sheet .item-unit { margin-top: 4px; }
.doc-sheet .items tbody tr:nth-child(even) td { background: #f8fafc; }
.doc-sheet .bottom td { vertical-align: top; padding-top: 12px; }
.doc-sheet .bottom-totals { width: 100%; margin-top: 4px; }
.doc-sheet .totals-spacer { width: 52%; }
.doc-sheet .notes-cell { width: 58%; padding-right: 20px; }
.doc-sheet .totals-cell { width: 48%; }
.doc-sheet .doc-notes {
  margin-top: 8px;
  padding-top: 0;
  clear: both;
}
.doc-sheet .note-block { margin-bottom: 10px; line-height: 1.5; }
.doc-sheet .note-block + .note-block { margin-top: 18px; }
.doc-sheet .note-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy-800);
  margin-top: 4px;
  margin-bottom: 8px;
}
.doc-sheet .note-prose {
  font-size: 12.5px;
  line-height: 1.7;
  color: #1a2332;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.doc-sheet .note-prose p {
  margin: 0 0 0.55em;
}
.doc-sheet .note-prose p:last-child { margin-bottom: 0; }
.doc-sheet .note-prose ol,
.doc-sheet .note-prose ul {
  margin: 0;
  padding-left: 1.35em;
}
.doc-sheet .note-prose li {
  margin: 0 0 0.4em;
  padding-left: 0.15em;
  color: #1a2332;
}
.doc-sheet .note-prose li:last-child { margin-bottom: 0; }
.doc-sheet .note-prose strong,
.doc-sheet .note-prose b {
  color: #103860;
  font-weight: 700;
}
/* Paper is always light for invoices/quotes — except the on-screen user manual sheet */
.theme-dark .doc-sheet:not(.manual-print-sheet) {
  color: #1a2332;
  background: #fff;
}
.theme-dark .doc-sheet:not(.manual-print-sheet) .note-prose,
.theme-dark .doc-sheet:not(.manual-print-sheet) .note-prose li,
.theme-dark .doc-sheet:not(.manual-print-sheet) .muted,
.theme-dark .doc-sheet:not(.manual-print-sheet) .sign-table td,
.theme-dark .doc-sheet:not(.manual-print-sheet) .meta-label,
.theme-dark .doc-sheet:not(.manual-print-sheet) .party-tagline {
  color: #243447 !important;
}
.theme-dark .doc-sheet:not(.manual-print-sheet) .note-label,
.theme-dark .doc-sheet:not(.manual-print-sheet) .thanks,
.theme-dark .doc-sheet:not(.manual-print-sheet) .doc-number,
.theme-dark .doc-sheet:not(.manual-print-sheet) .meta-value,
.theme-dark .doc-sheet:not(.manual-print-sheet) .party-name,
.theme-dark .doc-sheet:not(.manual-print-sheet) .note-prose strong,
.theme-dark .doc-sheet:not(.manual-print-sheet) .note-prose b {
  color: #103860 !important;
}
.doc-sheet .totals { width: 100%; }
.doc-sheet .totals td { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.doc-sheet .totals td:first-child { width: 58%; }
.doc-sheet .totals td:last-child { width: 42%; text-align: right; }
.doc-sheet .totals .grand td {
  background: var(--navy-800);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 16px;
  border: 0;
}
.doc-sheet .totals .balance td {
  background: var(--gold-500);
  color: #1a1a1a;
  font-weight: 700;
  padding: 12px 16px;
  border: 0;
}
.doc-sheet .party-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #103860;
  font-weight: 700;
}
.doc-sheet .party-to .party-contact {
  justify-content: flex-end;
}
.doc-sheet .party-contact svg {
  flex-shrink: 0;
  color: #103860;
}
.doc-sheet .doc-end {
  width: 100%;
  margin-top: 8px;
  padding-top: 6px;
}
.doc-sheet .sign-table { margin: 0; width: 100%; }
.doc-sheet .sign-table td {
  width: 50%;
  padding-top: 4px;
  font-size: 12px;
  color: var(--muted);
  vertical-align: bottom;
}
.doc-sheet .sign-cell-company { text-align: left; }
.doc-sheet .sign-cell-customer { text-align: right; }
.doc-sheet .sign-customer-space {
  height: 36px;
}
.doc-sheet .doc-stamp {
  width: auto;
  max-width: 300px;
  margin: 0 0 8px;
  border-collapse: collapse;
}
.doc-sheet .doc-stamp td {
  border: 0;
  padding: 0;
  vertical-align: middle;
}
.doc-sheet .doc-stamp-seal {
  width: 100px;
  padding: 10px 8px !important;
  border: 2.5px solid #103860;
  background: #fff;
  text-align: center;
  box-shadow: inset 0 0 0 4px rgba(200, 168, 80, 0.45);
}
.doc-sheet .doc-stamp-logo {
  display: block;
  margin: 0 auto 6px;
  max-width: 56px;
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.doc-sheet .doc-stamp-badge {
  color: #c8a850;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.doc-sheet .doc-stamp-sub {
  color: #5b6b7c;
  font-size: 8px;
  font-weight: 700;
  margin-top: 2px;
}
.doc-sheet .doc-stamp-meta {
  padding-left: 12px !important;
  font-size: 11px;
  line-height: 1.35;
  color: #5b6b7c;
  text-align: left;
}
.doc-sheet .doc-stamp-meta strong {
  display: block;
  color: #103860;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 2px;
}
.doc-sheet .doc-stamp-meta div { margin: 0; }
.doc-sheet .sign-line {
  border-top: 1px solid #c5d0dc;
  width: 78%;
  padding-top: 8px;
  margin-top: 10px;
  color: #5b6b7c;
  font-size: 12px;
}
.doc-sheet .sign-line-right { margin-left: auto; }
.doc-sheet .sign-role {
  margin-top: 4px;
  font-size: 10px;
  color: #5b6b7c;
  font-weight: 600;
}
.doc-sheet .sign-role-right { text-align: right; }
.theme-dark .doc-sheet .doc-stamp-seal {
  background: #fff;
}
.theme-dark .doc-sheet .doc-stamp-meta,
.theme-dark .doc-sheet .doc-stamp-meta div,
.theme-dark .doc-sheet .sign-role,
.theme-dark .doc-sheet .sign-line {
  color: #5b6b7c !important;
}
.theme-dark .doc-sheet .doc-stamp-meta strong {
  color: #103860 !important;
}
.doc-sheet .thanks { margin-top: 14px; color: var(--navy-800); font-weight: 700; }
.doc-sheet .doc-footer {
  width: auto;
  margin: 18px -32px 0;
  border-top: 2px solid var(--gold-500);
  padding: 12px 32px 0;
  box-sizing: border-box;
  text-align: center;
}
.doc-sheet .doc-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0;
  width: 100%;
  color: #103860;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.doc-sheet .doc-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: #103860;
  white-space: nowrap;
}
.doc-sheet .doc-contact-item + .doc-contact-item {
  border-left: 1.5px solid #c8a850;
}
.doc-sheet .doc-contact-item svg {
  flex-shrink: 0;
  color: #103860;
}
.doc-sheet .stamp {
  display: inline-block;
  border: 1px solid var(--gold-500);
  color: var(--navy-800);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

/* ——— Roles & permissions ——— */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}
.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  color: inherit;
}
.role-system-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.theme-dark .role-system-badge {
  background: #e8edf3;
  color: #0f1720;
}
.role-card:hover { color: inherit; }
.role-card-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-right: 64px;
}
.role-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
  color: var(--gold-400);
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}
.role-card-top strong {
  display: block;
  color: var(--navy-800);
  font-size: 15px;
}
.theme-dark .role-card-top strong { color: #fff; }
.role-card-top p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.role-meter {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.theme-dark .role-meter { color: #c5d0dc; }
.role-bar {
  height: 6px;
  border-radius: 999px;
  background: #e8eef4;
  overflow: hidden;
}
.theme-dark .role-bar { background: #2a3440; }
.role-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy-800), var(--gold-500));
  border-radius: 999px;
}
.role-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  color: var(--navy-700);
  font-size: 13px;
  font-weight: 700;
}
.theme-dark .role-link { color: var(--gold-400); }
.role-meta {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.theme-dark .role-meta { color: #b0bec9; }
.theme-dark .role-card-top p { color: #9aa8b5; }
.role-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin-top: 14px;
}
.role-card-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.role-card-actions .btn-navy {
  order: -1;
  flex: 1 1 100%;
}

.perm-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.perm-total {
  background: #eef3f8;
  color: var(--navy-800);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
}
.theme-dark .perm-total { background: #24303c; color: var(--gold-400); }
.perm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 16px;
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 8px);
  z-index: 20;
}
.perm-search {
  position: relative;
  flex: 1;
  min-width: min(220px, 100%);
  max-width: 420px;
}
.perm-search i {
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--muted);
}
.theme-dark .perm-search i {
  color: #d0b058;
}
.perm-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px 8px 36px;
  font: inherit;
  font-size: 13.5px;
}
.perm-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding-bottom: 88px;
}
.perm-card { overflow: hidden; }
.perm-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f7f9fc, #fff);
  border-bottom: 1px solid var(--border);
}
.theme-dark .perm-card-head { background: #151b22; }
.perm-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--navy-800);
  color: var(--gold-400);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.perm-card-head h2 {
  margin: 0;
  font-size: var(--h6);
  font-weight: 800;
  color: var(--navy-800);
  letter-spacing: -0.02em;
}
.theme-dark .perm-card-head h2 { color: #fff; }
.perm-count {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}
.perm-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.perm-switch input { accent-color: var(--navy-800); }
.perm-list { padding: 8px; }
.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin: 0;
}
.perm-item:hover { background: rgba(16, 56, 96, 0.05); }
.theme-dark .perm-item:hover { background: rgba(200, 168, 80, 0.08); }
.perm-item input {
  appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d7dee6;
  border: 0;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background .15s ease;
}
.theme-dark .perm-item input { background: #3a4654; }
.perm-item input:checked { background: var(--navy-800); }
.perm-item input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 56, 96, 0.2);
  transition: transform .15s ease;
}
.perm-item input:checked::after { transform: translateX(18px); }
.perm-action {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
  min-width: 64px;
  text-align: center;
  background: #eef3f8;
  color: var(--navy-800);
}
.perm-action-view { background: #e8eef5; color: #103860; }
.perm-action-create { background: #f7f0dc; color: #8a6d1f; }
.perm-action-edit { background: #e7f4fb; color: #185880; }
.perm-action-delete { background: #fdecea; color: #b42318; }
.perm-action-export, .perm-action-print { background: #eef6ee; color: #1f6b3a; }
.perm-action-import { background: #e7f4fb; color: #185880; }
.perm-action-manage, .perm-action-approve { background: #f3e8f8; color: #6d28d9; }
.perm-action-general,
.perm-action-integrations,
.perm-action-email,
.perm-action-taxes,
.perm-action-currencies,
.perm-action-templates,
.perm-action-numbering,
.perm-action-masters {
  background: #e8eef5;
  color: #103860;
}
.perm-name { font-size: 13px; font-weight: 600; color: var(--text); }
.perm-savebar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 56, 96, 0.14);
  padding: 12px 16px;
  z-index: 20;
}
@media (max-width: 768px) {
  .perm-savebar { flex-direction: column; align-items: stretch; }
  .perm-toolbar-actions { width: 100%; }
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}
#lineItems { min-width: 860px; }
.dt-wrap {
  overflow: visible;
}
.dt-wrap > .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fafc, #fff);
  position: relative;
  z-index: 5;
  overflow: visible;
}
.theme-dark .dt-toolbar { background: #151b22; }
.dt-toolbar-left,
.dt-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dt-length,
.dt-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.dt-toolbar .form-select,
.dt-date {
  width: auto;
  min-width: 132px;
}
.dt-search-field {
  position: relative;
  display: inline-block;
}
.dt-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.theme-dark .dt-search i {
  color: #d0b058;
}
.dt-search .form-control {
  width: 240px;
  padding-left: 32px;
}
.dt-wrap .table {
  margin: 0;
}
.dt-wrap .table thead th {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f4f7fb;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.theme-dark .dt-wrap .table thead th { background: #12181f; }
.dt-wrap .table tbody td {
  vertical-align: middle;
  padding: 12px 14px;
}
.dt-wrap .table tbody tr:hover { background: rgba(16, 56, 96, 0.035); }
.dt-cards { padding: 12px 16px 4px; }
.dt-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.theme-dark .dt-footer { background: #151b22; }
.dt-footer .pagination .page-link {
  border-radius: 8px;
  margin: 0 2px;
  border-color: var(--border);
  color: var(--navy-800);
  font-weight: 700;
  font-size: 12.5px;
}
.dt-footer .pagination .page-item.active .page-link {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
}
.dt-footer .pagination .page-item.disabled .page-link { color: #9aa8b5; }
.theme-dark .dt-footer .pagination .page-link {
  background: #1b222b;
  color: #eef3f8;
  border-color: #3a4654;
}
.theme-dark .dt-footer .pagination .page-item.active .page-link {
  background: var(--gold-500);
  color: #1a1a1a;
  border-color: var(--gold-500);
}
.sort-link {
  color: inherit;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sort-link i { font-size: 12px; opacity: .45; }
.sort-link.is-active { color: var(--navy-800); }
.sort-link.is-active i { opacity: 1; color: var(--gold-600); }
.theme-dark .sort-link.is-active { color: var(--gold-400); }
.listing-pager-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
@media (max-width: 768px) {
  .dt-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .dt-toolbar-left,
  .dt-toolbar-right {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }
  .dt-length {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
  }
  .theme-dark .dt-length { background: rgba(255,255,255,0.04); }
  .dt-length .form-select {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 120px;
    margin-left: auto;
  }
  .dt-toolbar-left > .form-select,
  .dt-toolbar-left > .dt-date {
    width: 100%;
    min-width: 0;
  }
  .dt-toolbar-left > .form-select:last-child:nth-child(even),
  .dt-toolbar-left > .dt-date:last-child:nth-child(even) {
    grid-column: 1 / -1;
  }
  .dt-toolbar-right > .listing-cols {
    grid-column: 1 / -1;
  }
  .listing-cols-toggle {
    width: 100%;
    justify-content: center;
  }
  .dt-search {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }
  .dt-search-label {
    display: none;
  }
  .dt-search-field {
    display: block;
    width: 100%;
  }
  .dt-search .form-control {
    width: 100%;
    min-width: 0;
  }
  .dt-toolbar-right > .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
  .dt-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .dt-footer .pagination {
    justify-content: center;
  }
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  margin: 0 0 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: none;
  overflow-x: visible;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 118px;
  max-width: 180px;
  flex: 1 1 118px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.settings-tab:hover {
  color: var(--navy-800);
  background: rgba(16, 56, 96, 0.05);
}
.theme-dark .settings-tab:hover {
  color: #fff;
  background: rgba(200, 168, 80, 0.08);
}
.settings-tab i {
  font-size: 16px;
  color: var(--gold-600);
}
.settings-tab strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.settings-tab small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  opacity: .75;
  margin-top: 1px;
}
.settings-tab.is-active {
  background: var(--navy-800);
  color: #fff;
}
.settings-tab.is-active i { color: var(--gold-400); }
.settings-tab.is-active:hover { color: #fff; background: var(--navy-800); }

.settings-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 22px;
}
.settings-subtab {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted, #6b7c8f);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--card);
}
.settings-subtab:hover { color: var(--navy-800); border-color: color-mix(in srgb, var(--navy-800) 25%, var(--border)); }
.settings-subtab.is-active {
  color: #fff;
  background: var(--navy-800);
  border-color: var(--navy-800);
}
.theme-dark .settings-subtab {
  color: #c5d0da;
  background: var(--card);
  border-color: var(--border);
}
.theme-dark .settings-subtab:hover {
  color: #fff;
  border-color: color-mix(in srgb, var(--gold-500) 40%, var(--border));
}
.theme-dark .settings-subtab.is-active {
  color: #103860;
  background: var(--gold-500);
  border-color: var(--gold-500);
}

.integration-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.integration-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  min-height: 148px;
  transition: border-color .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.integration-card-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex: 1;
}
.integration-card-main:hover { color: inherit; }
.integration-card:hover {
  border-color: color-mix(in srgb, var(--gold-500) 45%, var(--border));
  box-shadow: 0 8px 24px rgba(16, 56, 96, 0.06);
  color: inherit;
  text-decoration: none;
}
.integration-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--navy-800) 8%, transparent);
  color: var(--navy-800);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.integration-card-body { display: grid; gap: 4px; flex: 1; min-width: 0; }
.integration-card-body strong {
  font-size: 1.02rem;
  color: var(--navy-800);
}
.integration-card-body small {
  color: var(--muted);
  line-height: 1.35;
}
.integration-status {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
}
.integration-status.is-on {
  color: #0f5132;
  background: #d1e7dd;
}
.integration-status.is-off {
  color: #664d03;
  background: #fff3cd;
}
.settings-card-head .integration-status { margin-left: auto; }
.integration-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.integration-card-actions form { margin: 0; }
.integration-card-last {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}
.integration-card-last.is-ok { color: #0f5132; }
.integration-card-last.is-err { color: #842029; }

/* Integrations hub — Info dialog body */
.app-dialog-card:has(.integration-info) {
  width: min(560px, 100%);
  text-align: left;
}
.integration-info {
  text-align: left;
  color: var(--text, #1a2332);
}
.integration-info-summary {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted, #5a6a7a);
}
.integration-info h4 {
  margin: 1rem 0 0.4rem;
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy-800, #0b1f3a);
}
.integration-info-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.integration-info-list li { margin-bottom: 0.35rem; }
.integration-info-where,
.integration-info-empty {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted, #5a6a7a);
}
.theme-dark .integration-info { color: var(--text) !important; }
.theme-dark .integration-info-summary,
.theme-dark .integration-info-where,
.theme-dark .integration-info-empty { color: var(--muted) !important; }
.theme-dark .integration-info h4 { color: var(--gold-500, #e8c547) !important; }
.theme-dark .integration-info-list { color: var(--text) !important; }

/* Dark mode: cards must use theme surface + readable ink (never light text on white) */
.theme-dark .integration-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: none;
}
.theme-dark .integration-card:hover {
  border-color: color-mix(in srgb, var(--gold-500) 50%, var(--border)) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  color: var(--text) !important;
}
.theme-dark .integration-card-main,
.theme-dark .integration-card-main:hover {
  color: var(--text) !important;
}
.theme-dark .integration-card-icon {
  background: rgba(232, 200, 92, 0.12) !important;
  color: var(--gold-400) !important;
}
.theme-dark .integration-card-body strong {
  color: #fff !important;
}
.theme-dark .integration-card-body small {
  color: #c5d0da !important;
}
.theme-dark .integration-status.is-on {
  color: #a3e4c0 !important;
  background: rgba(15, 81, 50, 0.45) !important;
}
.theme-dark .integration-status.is-off {
  color: #f0e2a8 !important;
  background: rgba(102, 77, 3, 0.45) !important;
}
.theme-dark .integration-card-last { color: #c5d0da !important; }
.theme-dark .integration-card-last.is-ok { color: #8fd4ad !important; }
.theme-dark .integration-card-last.is-err { color: #f0a8b0 !important; }
.theme-dark .integration-guide {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}
.theme-dark .integration-last-test.is-ok {
  background: rgba(15, 81, 50, 0.35);
  border-color: #2d6a4f;
  color: #a3e4c0;
}
.theme-dark .integration-last-test.is-err {
  background: rgba(132, 32, 41, 0.35);
  border-color: #842029;
  color: #f0a8b0;
}
.theme-dark .settings-card-head {
  background: #151b22 !important;
}
.theme-dark .settings-card {
  background: var(--card) !important;
  border-color: var(--border) !important;
}
.theme-dark .settings-card-body {
  color: var(--text);
}
.theme-dark .settings-card-body .form-label,
.theme-dark .settings-card-body .form-hint,
.theme-dark .settings-card-body .form-text {
  color: #c5d0da;
}
.theme-dark .text-muted {
  color: #c5d0da !important;
}
.integration-test-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 16px;
}
.integration-test-bar .form-control { max-width: 280px; }
.integration-last-test {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 18px 0 14px;
  border: 1px solid var(--border);
}
.integration-last-test.is-ok { background: #d1e7dd; border-color: #badbcc; color: #0f5132; }
.integration-last-test.is-err { background: #f8d7da; border-color: #f5c2c7; color: #842029; }
.integration-last-test p { margin: 6px 0 0; }
.integration-last-test span { font-size: 0.8rem; opacity: .85; margin-left: 8px; }
.integration-guide {
  background: color-mix(in srgb, var(--navy-800) 5%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 18px;
}
.integration-guide ol { margin: 0 0 10px; padding-left: 1.2rem; }
.integration-guide li { margin-bottom: 4px; }
.integration-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 280px;
  overflow: auto;
}

.api-docs-dialog {
  border: none;
  padding: 0;
  border-radius: 16px;
  max-width: min(720px, calc(100vw - 24px));
  width: 100%;
  background: transparent;
}
.api-docs-dialog::backdrop {
  background: rgba(6, 16, 24, 0.55);
}
.api-docs-panel {
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(6, 16, 24, 0.22);
}
.api-docs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.api-docs-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy-800);
}
.api-docs-body {
  padding: 16px 18px 18px;
  max-height: min(70vh, 560px);
  overflow: auto;
}
.api-docs-body .font-monospace,
.api-docs-body textarea.font-monospace,
.api-docs-body input.font-monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.settings-grid {
  display: grid;
  gap: var(--card-gap);
}
.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: var(--card-gap);
}
.settings-card.mb-1,
.settings-card.mb-2,
.settings-card.mb-3,
.settings-card.mb-4,
.settings-card.mb-5 {
  margin-bottom: var(--card-gap) !important;
}
.settings-card.mt-2,
.settings-card.mt-3,
.settings-card.mt-4 {
  margin-top: 0;
}
.settings-grid > .settings-card {
  margin-bottom: 0;
}
.settings-grid > form {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  min-width: 0;
}
.settings-grid > form > .settings-card {
  margin-bottom: 0;
}
.settings-grid > form > .settings-savebar {
  margin-top: 0;
}
.settings-card + .settings-savebar {
  margin-top: 0;
}
.row > [class*="col"] > .settings-card:last-child {
  margin-bottom: 0;
}
.settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f7f9fc, #fff);
}
.theme-dark .settings-card-head { background: #151b22; }
.settings-card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .settings-card-head h2 { color: #fff; }
.settings-card-head p {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.settings-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--navy-800);
  color: var(--gold-400);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.settings-card-body { padding: 18px; }
.fx-rate {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.fx-meta {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.fx-dir {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.fx-dir.is-up { color: #2a9a62; }
.fx-dir.is-down { color: #c45c4a; }
.fx-dir.is-flat { color: var(--muted); }
.theme-dark .badge.text-bg-light,
.theme-dark .badge.text-bg-secondary,
.theme-dark .badge.bg-light,
.theme-dark .badge.bg-secondary {
  background-color: #2a3848 !important;
  color: #eef3f8 !important;
  border: 1px solid #3d4d5e;
}
.theme-dark .table {
  --bs-table-border-color: #2f3b48;
}
.theme-dark .table > :not(caption) > * > * {
  border-bottom-color: #2f3b48;
}
.settings-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.settings-logo {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.settings-logo img { max-width: 72px; max-height: 72px; object-fit: contain; }
.settings-logo-sm {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}
.settings-logo-sm img { max-width: 40px; max-height: 40px; }
.brand-preview-frame {
  max-width: 280px;
  border-radius: 14px;
  overflow: hidden;
  background: #e8eef4;
  border: 1px solid var(--border);
}
.brand-preview-frame .sidebar-brand {
  border-bottom: 0;
  padding: 14px 16px;
}
.theme-dark .brand-preview-frame {
  background: #103860;
  border-color: #3d4c5c;
}
.settings-inline-save { margin-top: 16px; }
.settings-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.settings-inline-form .form-control { max-width: 280px; flex: 1; min-width: 0; }
.mail-queue-badges {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mail-queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.mail-queue-table td { vertical-align: top; }

.email-logo-options {
  display: grid;
  gap: 10px;
}
.email-logo-option {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
  position: relative;
}
.theme-dark .email-logo-option { background: #151b22; }
.email-logo-option.is-active,
.email-logo-option:has(input:checked) {
  border-color: #c8a850;
  box-shadow: 0 0 0 1px rgba(200, 168, 80, 0.35);
}
.email-logo-option input { position: absolute; opacity: 0; pointer-events: none; }
.email-logo-option-preview {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #103860;
}
.email-logo-option-preview img {
  display: block;
  height: 34px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
}
.email-logo-option-preview.is-icon { gap: 10px; }
.email-logo-option-preview.is-icon img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  padding: 3px;
}
.email-logo-option-preview.is-icon span {
  display: grid;
  gap: 2px;
  color: #fff;
  min-width: 0;
}
.email-logo-option-preview.is-icon b {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}
.email-logo-option-preview.is-icon i {
  font-style: normal;
  color: #E8C85C;
  font-size: 11px;
  font-weight: 700;
}
.email-logo-option strong {
  font-size: 14px;
  color: var(--navy-800);
}
.theme-dark .email-logo-option strong { color: #fff; }
.email-logo-option small {
  color: #5b6b7c;
  font-size: 12px;
  font-weight: 600;
}
.email-logo-upload {
  display: grid;
  gap: 6px;
  padding: 0 2px 8px;
}
.email-logo-upload .form-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
.email-logo-upload-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.email-color-field {
  display: flex;
  gap: 8px;
  align-items: center;
}
.email-color-field input[type="color"] {
  width: 44px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.email-contact-checks {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
.theme-dark .email-contact-checks { background: #151b22; }
.email-contact-checks .form-check {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.email-brand-preview-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5b6b7c;
  margin-bottom: 8px;
}
.email-brand-preview-frame {
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  max-width: 600px;
}
.email-brand-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: #103860;
  color: #fff;
}
.email-brand-preview-brand { min-width: 0; flex: 1 1 auto; }
.email-preview-full {
  display: block;
  height: 40px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
.email-preview-tag {
  margin-top: 6px;
  color: #E8C85C;
  font-size: 11px;
  font-weight: 700;
}
.email-preview-icon-text {
  display: flex;
  align-items: center;
  gap: 10px;
}
.email-preview-icon-text img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
}
.email-preview-icon-text span { display: grid; gap: 2px; min-width: 0; }
.email-preview-icon-text b {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.email-preview-icon-text i {
  font-style: normal;
  color: #E8C85C;
  font-size: 11px;
  font-weight: 700;
}
.email-brand-preview-quick {
  flex: 0 1 46%;
  text-align: right;
  font-size: 11px;
  line-height: 1.45;
  color: #e8eef4;
}
.email-brand-preview-quick strong {
  display: block;
  margin-bottom: 6px;
  color: #E8C85C;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.email-brand-preview-quick em {
  color: #E8C85C;
  font-style: normal;
  font-weight: 700;
  margin-right: 4px;
}
.email-brand-preview-bar { height: 4px; background: #E8C85C; }
.email-brand-preview-body {
  padding: 16px 18px;
  color: #1a2332;
}
.email-brand-preview-body strong {
  display: block;
  color: #103860;
  margin-bottom: 6px;
}
.email-brand-preview-body p {
  margin: 0;
  color: #3d4f63;
  font-size: 14px;
  line-height: 1.55;
}
@media (max-width: 767px) {
  .email-brand-preview-head { flex-direction: column; align-items: flex-start; }
  .email-brand-preview-quick { text-align: left; flex-basis: auto; width: 100%; }
}

.settings-savebar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 56, 96, 0.14);
  padding: 12px 16px;
  z-index: 20;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.settings-savebar p { margin: 0; }

.notify-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.notify-choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  background: #fff;
}
.notify-choice:has(input:checked) {
  border-color: #c8a850;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(232, 200, 92, 0.25);
}
.notify-choice input {
  margin-top: 4px;
  flex-shrink: 0;
}
.notify-choice strong {
  display: block;
  color: var(--navy-800);
  font-size: 14.5px;
}
.notify-choice small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.theme-dark .notify-choice { background: rgba(255,255,255,0.04); }
.theme-dark .notify-choice:has(input:checked) { background: rgba(232, 200, 92, 0.12); }
.settings-lookup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 14px;
}
.settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 18px 18px;
}
.settings-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--navy-800);
  font-size: 12.5px;
  font-weight: 700;
}
.theme-dark .settings-chip {
  background: #243040;
  color: #eef3f8;
}
.ticket-files { display: grid; gap: 8px; }
.ticket-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f9fc;
}
.theme-dark .ticket-file { background: #151b22; }
.ticket-file a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
  color: var(--navy-800);
}
.theme-dark .ticket-file a { color: #eef3f8; }
.ticket-file a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-file small { color: var(--muted); font-weight: 650; white-space: nowrap; }
.badge-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-source i { font-size: 12px; }
.badge-source.is-customer {
  background: #e8f1fb;
  color: #103860;
  border: 1px solid #c5d7ec;
}
.badge-source.is-staff {
  background: #f7f0d8;
  color: #6b5420;
  border: 1px solid #e4d39a;
}
.theme-dark .badge-source.is-customer { background: #1a2c44; color: #d5e6f7; border-color: #2d4664; }
.theme-dark .badge-source.is-staff { background: #3a3318; color: #f0e2a8; border-color: #5c4e22; }
.badge-source.is-existing {
  background: #e7f4ea;
  color: #1b5e20;
  border: 1px solid #b7dfbf;
}
.badge-source.is-new-account {
  background: #eef2f7;
  color: #243447;
  border: 1px solid #cfd8e3;
}
.badge-source.is-converted {
  background: #e8f1fb;
  color: #103860;
  border: 1px solid #c5d7ec;
}
.theme-dark .badge-source.is-existing { background: #16351c; color: #c8efd0; border-color: #2a5a34; }
.theme-dark .badge-source.is-new-account { background: #243044; color: #d5deea; border-color: #3a4a60; }
.theme-dark .badge-source.is-converted { background: #1a2c44; color: #d5e6f7; border-color: #2d4664; }
.ticket-att-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--navy-800);
  text-decoration: none;
}
.ticket-att-count:hover { color: var(--navy-600); }
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.ticket-msg {
  display: flex;
  max-width: min(100%, 640px);
}
.ticket-msg.is-customer { align-self: flex-start; }
.ticket-msg.is-staff { align-self: flex-end; }
.ticket-msg-bubble {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f4f7fb;
}
.ticket-msg.is-staff .ticket-msg-bubble {
  background: #103860;
  border-color: #103860;
  color: #f4f7fb;
}
.ticket-msg.is-internal .ticket-msg-bubble {
  background: #fffbeb;
  border: 1px dashed #d4b44a;
  color: var(--navy-800);
}
.ticket-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 12px;
}
.ticket-msg-meta strong { font-size: 13px; }
.ticket-msg-meta span,
.ticket-msg-meta time { color: var(--muted); font-weight: 650; }
.ticket-msg.is-staff .ticket-msg-meta span,
.ticket-msg.is-staff .ticket-msg-meta time { color: rgba(244, 247, 251, 0.72); }
.ticket-msg.is-internal .ticket-msg-meta span { color: #8a6d1b; }
.ticket-msg.is-internal .ticket-msg-meta strong,
.ticket-msg.is-internal .ticket-msg-meta time { color: var(--navy-800); }
.ticket-msg-body { font-size: 14px; line-height: 1.5; }
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-body,
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-body p,
.ticket-msg.is-staff:not(.is-internal) .record-prose,
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-meta strong {
  color: #f4f7fb;
}
.ticket-msg.is-staff:not(.is-internal) .text-muted {
  color: rgba(244, 247, 251, 0.75) !important;
}
.ticket-msg.is-staff .ticket-msg-body a { color: #f0d36a; }
.ticket-msg-files {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ticket-msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d5deea;
  background: #fff;
  color: var(--navy-800);
}
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-file {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}
.ticket-msg.is-internal .ticket-msg-file {
  background: #fff;
  border: 1px solid #d4b44a;
  color: var(--navy-800);
}
.ticket-msg-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #eef3f8;
  color: var(--navy-800);
  font-size: 18px;
  flex-shrink: 0;
}
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-file-icon {
  background: rgba(255,255,255,0.16);
  color: #f0d36a;
}
.ticket-msg.is-internal .ticket-msg-file-icon {
  background: #fff6d6;
  color: #6b5420;
}
.ticket-msg-file-meta {
  min-width: 0;
  flex: 1;
  display: grid;
}
.ticket-msg-file-meta strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticket-msg-file-meta small {
  color: var(--muted);
  font-weight: 650;
}
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-file-meta small {
  color: rgba(244, 247, 251, 0.72);
}
.ticket-msg.is-internal .ticket-msg-file-meta small { color: #8a6d1b; }
.ticket-msg-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-file-actions .btn-view,
.ticket-msg.is-staff:not(.is-internal) .ticket-msg-file-actions .btn-edit {
  background: #fff !important;
  color: var(--navy-800) !important;
  border-color: #fff !important;
}
.file-preview-dialog {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: grid;
  place-items: center;
  padding: 18px;
}
.file-preview-dialog[hidden] { display: none !important; }
.file-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 32, 0.72);
}
.file-preview-card {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  height: min(900px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(8, 18, 32, 0.35);
}
.file-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f7f9fc;
  flex-shrink: 0;
}
.file-preview-heading { min-width: 0; }
.file-preview-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.file-preview-head h3 {
  margin: 2px 0 0;
  font-size: 1rem;
  color: var(--navy-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(420px, 46vw);
}
.file-preview-zoom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.file-preview-zoom[hidden] { display: none !important; }
.file-preview-zoom span {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy-800);
}
.file-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.file-preview-main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: #111820;
}
.file-preview-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
}
.file-preview-body.is-image {
  display: block;
  cursor: grab;
}
.file-preview-body.is-frame {
  display: block;
}
.file-preview-body.is-image.is-panning { cursor: grabbing; }
.file-preview-body img {
  display: block;
  margin: 0 auto;
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.file-preview-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.file-preview-body audio {
  width: min(480px, 90%);
  margin: auto;
}
.file-preview-body iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  background: #fff;
}
.file-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--navy-800);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  display: grid;
  place-items: center;
  font-size: 22px;
}
.file-preview-nav[hidden] { display: none !important; }
.file-preview-nav:hover { background: #fff; }
.file-preview-nav.is-prev { left: 12px; }
.file-preview-nav.is-next { right: 12px; }
.file-preview-film {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  background: #0d141c;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.file-preview-film[hidden] { display: none !important; }
.file-preview-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #1b2430;
  color: #f0d36a;
  display: grid;
  place-items: center;
  padding: 0;
}
.file-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-preview-thumb.is-active {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 1px var(--gold-500);
}
.file-preview-fallback {
  color: #e8eef5;
  text-align: center;
  padding: 24px;
  max-width: 420px;
}
body.file-preview-open { overflow: hidden; }
.theme-dark .file-preview-card { background: #151c26; }
.theme-dark .file-preview-head { background: #1b2430; border-color: #2c3948; }
.theme-dark .file-preview-head h3 { color: #f2f6fa; }
.theme-dark .file-preview-zoom { background: #151c26; border-color: #2c3948; }
.theme-dark .file-preview-zoom span { color: #f2f6fa; }
@media (max-width: 700px) {
  .ticket-msg-file { flex-wrap: wrap; }
  .ticket-msg-file-actions { width: 100%; }
  .file-preview-dialog { padding: 8px; }
  .file-preview-card { height: calc(100dvh - 16px); border-radius: 12px; }
  .file-preview-head {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .file-preview-head h3 { max-width: none; }
  .file-preview-toolbar .btn { flex: 1; }
  .file-preview-zoom { order: 3; width: 100%; justify-content: center; }
  .file-preview-nav { width: 36px; height: 36px; }
}
.ticket-composer {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.ticket-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ticket-composer-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}
.settings-master-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 14px;
}
.master-rows { padding: 8px 10px 12px; }
.master-empty {
  margin: 8px 6px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.master-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
}
.master-row:last-child { border-bottom: 0; }
.master-rename {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.master-row .form-control {
  min-height: 38px;
  height: 38px;
  font-weight: 650;
}
.master-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.master-used {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--navy-800);
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.theme-dark .master-used { background: #243040; color: #eef3f8; }
.master-row.is-off .form-control { opacity: .55; }
.master-add {
  background: #f7f9fc;
  border: 0;
  border-radius: 10px;
  margin-top: 8px;
  padding: 8px;
}
.theme-dark .master-add { background: #151b22; }
.master-add .form-control { flex: 1; }
@media (max-width: 575px) {
  .master-row, .master-add { flex-wrap: wrap; }
  .master-rename { flex: 1 1 100%; }
  .master-row-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 768px) {
  .settings-savebar { flex-direction: column; align-items: stretch; }
  .settings-tab { min-width: 118px; }
  .notify-choices { grid-template-columns: 1fr; }
}

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  padding: 28px 30px;
  margin-bottom: 8px;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(520px 180px at 92% -20%, rgba(200, 168, 80, 0.35), transparent 60%),
    radial-gradient(280px 140px at 8% 120%, rgba(32, 120, 168, 0.35), transparent 55%),
    linear-gradient(135deg, #081c30 0%, #103860 58%, #185880 100%);
  box-shadow: 0 18px 40px rgba(16, 56, 96, 0.22);
}
.dash-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-400);
}
.dash-hero h1 {
  margin: 0 0 8px;
  font-size: 1.85rem;
  color: #fff;
}
.dash-hero-copy p {
  margin: 0;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13.5px;
  font-weight: 500;
}
.dash-range { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.dash-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.dash-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.dash-chip:hover { color: #fff; background: rgba(200, 168, 80, 0.22); }
.dash-chip.is-active {
  background: var(--gold-500);
  color: #1a1408;
  border-color: var(--gold-500);
}
.dash-range-fields { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dash-range-fields .form-control {
  width: auto;
  min-width: 148px;
  background: rgba(8, 28, 48, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
  color-scheme: light;
}
.dash-range-fields .form-control:hover,
.dash-range-fields .form-control:focus {
  background: rgba(8, 28, 48, 0.78);
  color: #fff;
  border-color: var(--gold-500);
}
.dash-range-fields .form-control::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.85);
  opacity: 1;
  cursor: pointer;
}
body.theme-dark .dash-range-fields .form-control,
body.theme-dark .dash-range-fields .form-control:hover,
body.theme-dark .dash-range-fields .form-control:focus {
  background: rgba(8, 28, 48, 0.7);
  color: #fff;
  color-scheme: light;
}
.dash-section { margin-top: 22px; }
.dash-section-sub {
  margin: -4px 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.dash-grid-today {
  margin-bottom: 14px;
}
.dash-section > h2 {
  margin: 0 0 12px;
  font-size: var(--text-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dash-kpi {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: background-color .16s ease, border-color .16s ease;
}
a.dash-kpi,
a.dash-kpi:hover,
.theme-dark a.dash-kpi,
.theme-dark a.dash-kpi:hover { color: inherit; }
.dash-kpi.tone-navy { background: #f6f9fc; }
.dash-kpi.tone-gold { background: #fbf8ef; }
.dash-kpi.tone-teal { background: #f4f9fb; }
.dash-kpi.tone-rose { background: #fcf6f5; }
.dash-kpi.tone-green { background: #f4faf6; }
.theme-dark .dash-kpi.tone-navy,
.theme-dark .dash-kpi.tone-teal { background: #18222c; }
.theme-dark .dash-kpi.tone-gold { background: #221f18; }
.theme-dark .dash-kpi.tone-rose { background: #241c1b; }
.theme-dark .dash-kpi.tone-green { background: #18221c; }
.dash-kpi:hover {
  color: inherit;
  transform: none;
  border-color: var(--gold-500);
  background: #fff;
  box-shadow: 0 0 0 1px var(--gold-500);
}
.theme-dark .dash-kpi:hover { background: #1b222b; }
.dash-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
  background: #fff;
  color: var(--navy-800);
  box-shadow: 0 0 0 1px rgba(16, 56, 96, 0.08);
}
.dash-kpi.tone-navy .dash-kpi-icon { color: var(--navy-800); }
.dash-kpi.tone-gold .dash-kpi-icon { color: var(--gold-700); }
.dash-kpi.tone-teal .dash-kpi-icon { color: var(--navy-600); }
.dash-kpi.tone-rose .dash-kpi-icon { color: #c45c4a; }
.dash-kpi.tone-green .dash-kpi-icon { color: #2a9a62; }
/* Must match/exceed tone-* specificity or navy icons stay #103860 in dark mode */
.theme-dark .dash-kpi .dash-kpi-icon {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: #9ec8ea;
}
.theme-dark .dash-kpi.tone-navy .dash-kpi-icon { color: #9ec8ea; }
.theme-dark .dash-kpi.tone-gold .dash-kpi-icon { color: var(--gold-400); }
.theme-dark .dash-kpi.tone-teal .dash-kpi-icon { color: #7ec8e8; }
.theme-dark .dash-kpi.tone-rose .dash-kpi-icon { color: #f0a090; }
.theme-dark .dash-kpi.tone-green .dash-kpi-icon { color: #6fd4a0; }
.dash-kpi-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.dash-kpi-value {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--navy-800);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.theme-dark .dash-kpi-value { color: #fff; }
.dash-kpi-label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-dark .dash-kpi-label { color: #b8c6d4; }
.dash-kpi-hint { display: none; }
.dash-kpi-top,
.dash-kpi-go { display: none; }
.dash-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 18px 12px;
  height: 100%;
}
.dash-panel > header { margin-bottom: 8px; }
.dash-panel h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .dash-panel h3 { color: #fff; }
.dash-panel header p {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dash-panel-link {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.dash-chart { position: relative; height: 240px; }
.dash-chart-sm { height: 210px; }
.dash-feed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
a.dash-feed-item,
a.dash-feed-item:hover,
.theme-dark a.dash-feed-item,
.theme-dark a.dash-feed-item:hover { color: inherit; }
.dash-feed-item:last-child { border-bottom: 0; }
.dash-feed-item:hover { color: inherit; }
.dash-feed-item small,
.dash-feed-item em {
  display: block;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dash-feed-item strong { display: block; font-size: 13.5px; }
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .dash-hero { padding: 22px 18px; align-items: stretch; }
  .dash-range, .dash-chips { align-items: stretch; justify-content: flex-start; }
  .dash-range-fields { justify-content: stretch; }
  .dash-range-fields .form-control { flex: 1; min-width: 0; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.record-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-600);
}
.reminder-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
}
.reminder-hero-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--navy-800);
  color: var(--gold-400);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}
.reminder-hero.is-overdue .reminder-hero-mark {
  background: #b42318;
  color: #fff;
}
.reminder-hero.is-done .reminder-hero-mark {
  background: #1d6b4a;
  color: #fff;
}
.reminder-hero-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.reminder-hero-when {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--navy-800);
  margin-top: 2px;
}
.theme-dark .reminder-hero-when { color: #fff; }
.reminder-hero.is-overdue .reminder-hero-when { color: #b42318; }
.reminder-hero-sub {
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.reminder-hero .kpi .value i,
.kpi .value i {
  font-size: .9em;
  color: var(--gold-600);
  margin-right: 4px;
}
.page-head .badge { margin-right: 4px; }
.settings-card-head > div { min-width: 0; }
.settings-card-head .btn { flex-shrink: 0; }

.tpl-group { margin-bottom: 22px; }
.tpl-group h2 {
  margin: 0 0 10px;
  font-size: var(--text-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tpl-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tpl-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
  min-height: 100%;
}
.tpl-item:hover { color: inherit; }
.tpl-item-copy {
  min-width: 0;
  flex: 1;
}
.tpl-item-copy strong {
  display: block;
  font-size: 15px;
  color: var(--navy-800);
}
.theme-dark .tpl-item-copy strong { color: #fff; }
.tpl-item-copy small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.tpl-item-open {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy-700);
  white-space: nowrap;
}
.theme-dark .tpl-item-open { color: var(--gold-400); }
@media (max-width: 900px) {
  .tpl-list { grid-template-columns: 1fr; }
}
.tpl-editor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tpl-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr);
  gap: 16px;
  align-items: start;
}
.tpl-editor-main { padding: 20px; }
.tpl-shortcodes {
  margin: 18px 0 16px;
  display: grid;
  gap: 12px;
}
.tpl-shortcode-group > span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.tpl-shortcode-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tpl-chip {
  border: 1px solid #d5dee8;
  background: #f4f7fb;
  color: var(--navy-800);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.tpl-chip:hover {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: var(--gold-400);
}
.theme-dark .tpl-chip {
  background: #24303c;
  border-color: #3a4654;
  color: #e8eef4;
}
.theme-dark .tpl-chip:hover {
  background: var(--gold-500);
  border-color: var(--gold-500);
  color: #1a1a1a;
}
.doc-terms-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.doc-terms-tools .btn {
  white-space: nowrap;
}
.doc-terms-tools .form-hint {
  flex: 1 1 220px;
}
.rich-field { margin-bottom: 4px; }
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #f4f7fb;
}
.rich-toolbar button {
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--navy-800);
  display: inline-grid;
  place-items: center;
}
.rich-toolbar button:hover { background: #e4ebf2; }
.theme-dark .rich-toolbar {
  background: #151b22;
  border-color: #2a3440;
}
.theme-dark .rich-toolbar button { color: #e8eef4; }
.theme-dark .rich-toolbar button:hover { background: #2a3542; }
.rich-visual {
  min-height: 110px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}
.rich-visual:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(232, 200, 92, 0.25);
}
.theme-dark .rich-visual {
  background: #151b22;
  border-color: #2a3440;
  color: #eef3f8;
}
.rich-visual p { margin: 0 0 0.55em; }
.rich-visual ol,
.rich-visual ul { margin: 0 0 0.55em; padding-left: 1.35em; }
.rich-visual li { margin-bottom: 0.35em; }
.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border: 1px solid #d5dee8;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #f4f7fb;
}
.theme-dark .tpl-toolbar {
  background: #1b242e;
  border-color: #3a4654;
}
.tpl-toolbar button {
  width: 36px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--navy-800);
  display: grid;
  place-items: center;
}
.tpl-toolbar button:hover { background: #e4ebf2; }
.theme-dark .tpl-toolbar button { color: #e8eef4; }
.theme-dark .tpl-toolbar button:hover { background: #2a3542; }
.tpl-visual {
  min-height: 280px;
  padding: 14px 16px;
  border: 1.5px solid #b7c4d1;
  border-radius: 0 0 12px 12px;
  background: #eef3f8;
  color: var(--navy-800);
  font-weight: 600;
  line-height: 1.6;
  outline: none;
}
.theme-dark .tpl-visual {
  background: #151c24;
  border-color: #3a4654;
  color: #eef3f8;
}
.tpl-visual:focus { border-color: var(--gold-500); }
.tpl-html {
  border-radius: 0 0 12px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.tpl-preview-card {
  padding: 18px;
  position: sticky;
  top: 88px;
}
.tpl-preview-card header { margin-bottom: 12px; }
.tpl-preview-card header strong { display: block; font-size: 14px; }
.tpl-preview-card header small { color: var(--muted); font-weight: 600; }
.tpl-preview-subject {
  font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--navy-800);
}
.theme-dark .tpl-preview-subject { color: #fff; }
.tpl-preview-mail {
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.tpl-preview-mail-head {
  background: #103860;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.tpl-preview-mail-brand {
  min-width: 0;
  flex: 1 1 auto;
}
.tpl-preview-mail-head img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 180px;
}
.tpl-preview-mail-head span {
  display: block;
  margin-top: 8px;
  color: #E8C85C;
  font-size: 11px;
  letter-spacing: 0.4px;
}
.tpl-preview-mail-quick {
  flex: 0 1 46%;
  text-align: right;
  color: #e8eef4;
  font-size: 11px;
  line-height: 1.45;
}
.tpl-preview-mail-quick strong {
  display: block;
  margin-bottom: 6px;
  color: #E8C85C;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.tpl-preview-mail-quick em {
  color: #E8C85C;
  font-style: normal;
  font-weight: 700;
  margin-right: 4px;
}
.tpl-preview-mail-gold {
  height: 4px;
  background: #E8C85C;
}
.tpl-preview-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--navy-800);
  padding: 18px;
  background: #fff;
}
.theme-dark .tpl-preview-body { color: #1a2332; }
.tpl-preview-body p { margin: 0 0 10px; }
.tpl-preview-mail-foot {
  background: #f4f7fb;
  border-top: 1px solid #d7e0ea;
  padding: 14px 18px;
}
.tpl-preview-mail-foot strong {
  display: block;
  color: #103860;
  font-size: 13px;
}
.tpl-preview-mail-foot small {
  display: block;
  margin-top: 4px;
  color: #5b6b7c;
  font-weight: 600;
}
@media (max-width: 991px) {
  .tpl-editor-grid { grid-template-columns: 1fr; }
  .tpl-preview-card { position: static; }
}

/* Detail pages: first card beside Record; later cards span full width into blank space */
.record-fill-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}
.record-fill-grid.has-aside {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}
.record-fill-grid.has-aside > .record-fill-card:first-child {
  grid-column: 1;
}
.record-fill-grid.has-aside > .record-fill-card:not(:first-child) {
  grid-column: 1 / -1;
}
.record-fill-grid.has-aside > .record-fill-aside {
  grid-column: 2;
  grid-row: 1;
}
.record-fill-grid:not(.has-aside) > .record-fill-card {
  grid-column: 1 / -1;
}
@media (max-width: 991.98px) {
  .record-fill-grid.has-aside {
    grid-template-columns: 1fr;
  }
  .record-fill-grid.has-aside > .record-fill-card,
  .record-fill-grid.has-aside > .record-fill-aside {
    grid-column: 1;
    grid-row: auto;
  }
}

.record-pairs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.record-pairs > div {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.record-pairs > div:nth-child(2n) { border-right: 0; }
.record-pairs.compact > div { padding: 12px 18px; }
.record-pairs span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.record-pairs strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy-800);
  word-break: break-word;
}
.theme-dark .record-pairs strong { color: #fff; }
.record-pairs a { color: inherit; text-decoration: none; }
.record-pairs a:hover { color: var(--gold-600); }
.copyable {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}
.copyable-block {
  align-items: flex-start;
  display: flex;
}
.copyable-block span { min-width: 0; }
.copy-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.copy-btn:hover {
  color: var(--navy-800);
  background: rgba(16, 56, 96, 0.08);
}
.copy-btn.is-copied { color: var(--gold-700); }
.theme-dark .copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
@media print {
  .copy-btn { display: none !important; }
}
.record-prose {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--navy-800);
}
.theme-dark .record-prose { color: #e8eef5; }
.record-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.record-list-item:last-child { border-bottom: 0; }
.record-list-item:hover { background: rgba(16, 56, 96, 0.04); color: inherit; }
.theme-dark .record-list-item:hover { background: rgba(200, 168, 80, 0.08); }
.record-list-item small {
  display: block;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.form-section-title {
  font-size: var(--text-label);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy-800);
  margin: 8px 0 4px;
}
.theme-dark .form-section-title { color: var(--gold-400); }

.profile-hero {
  padding: 22px 24px;
}
.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.profile-photo {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: var(--navy-800);
  color: var(--gold-400);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 800;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(200, 168, 80, 0.35);
  flex-shrink: 0;
}
.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-hero h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  color: var(--navy-800);
}
.theme-dark .profile-hero h2 { color: #fff; }
.profile-hero p { margin: 0; color: var(--muted); font-weight: 600; }
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.profile-theme {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.profile-theme-card {
  display: block;
  cursor: pointer;
}
.profile-theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.profile-theme-card span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1.5px solid #b7c4d1;
  border-radius: 14px;
  background: #eef3f8;
  color: var(--navy-800);
  min-height: 92px;
}
.profile-theme-card i { font-size: 20px; color: var(--gold-600); margin-bottom: 4px; }
.profile-theme-card strong { font-size: 14px; }
.profile-theme-card small { color: var(--muted); font-weight: 600; }
.profile-theme-card input:checked + span {
  border-color: var(--gold-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(200, 168, 80, 0.18);
}
.theme-dark .profile-theme-card span {
  background: #12181f;
  border-color: #3d4c5c;
  color: #fff;
}
.theme-dark .profile-theme-card input:checked + span { background: #1b222b; }
@media (max-width: 576px) {
  .record-pairs { grid-template-columns: 1fr; }
  .record-pairs > div { border-right: 0; }
}

.print-page-flow {
  width: 100%;
  max-width: none;
  border-collapse: collapse;
  border: 0;
  table-layout: fixed;
}
.print-page-flow > thead,
.print-page-flow > tfoot {
  display: none;
}
.print-page-flow > tbody > tr > td {
  padding: 0;
  border: 0;
  vertical-align: top;
}

@media print {
  /* Footer stays put. Repeating table footer reserves 100px so body text cannot cover it. */
  @page { margin: 10mm 12mm 25px 12mm; size: A4; }
  .print-page-flow > thead { display: table-header-group !important; }
  .print-page-flow > tfoot { display: table-footer-group !important; }
  .print-page-flow-gap { height: 42px; }
  .print-page-flow > thead > tr > td,
  .print-page-flow > tbody > tr > td,
  .print-page-flow > tfoot > tr > td {
    padding: 0 !important;
    border: 0 !important;
  }
  .sidebar,
  .topbar,
  .page-head,
  .page-actions,
  .sidebar-backdrop,
  .toast-stack,
  .no-print,
  .alert,
  .app-dialog,
  .app-footer,
  .gs-panel,
  .gs-overlay,
  #globalSearchWrap,
  .file-preview-overlay,
  .cal-fab,
  .theme-toggle,
  .notify-wrap {
    display: none !important;
  }
  html, body {
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .app-shell { display: block !important; background: #fff !important; }
  .main {
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    background: #fff !important;
  }
  .content { padding: 0 !important; margin: 0 !important; background: #fff !important; }
  .doc-sheet {
    box-shadow: none !important;
    border: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 0 calc(8mm + 20px) !important;
    margin: 0 !important;
    background: #fff !important;
    border-radius: 0 !important;
    display: block !important;
    overflow: visible !important;
  }
  .doc-sheet > .doc-shell {
    display: table !important;
    min-height: 0 !important;
    height: auto !important;
    flex: none !important;
  }
  .doc-sheet > .doc-shell > tbody {
    display: table-row-group !important;
    flex: none !important;
    min-height: 0 !important;
  }
  .doc-sheet > .doc-shell > tbody > tr.doc-shell-main,
  .doc-sheet > .doc-shell > tbody > tr.doc-shell-foot-row {
    display: table-row !important;
    margin-top: 0 !important;
    flex: none !important;
  }
  .doc-sheet > .doc-shell td.doc-shell-body,
  .doc-sheet > .doc-shell td.doc-shell-foot {
    display: table-cell !important;
  }
  .doc-sheet > .doc-shell td.doc-shell-body { vertical-align: top !important; }
  .doc-sheet > .doc-shell td.doc-shell-foot {
    vertical-align: top !important;
    padding-top: 10px !important;
    height: auto !important;
  }
  .doc-end {
    position: static !important;
    margin-top: 8px !important;
    padding-top: 4px !important;
  }
  .doc-sheet .doc-footer { display: none !important; }
  .doc-sheet .navy-bar { margin: 4px 0 0 !important; }
  .doc-sheet .gold-bar { margin: 0 0 8px !important; }
  .doc-sheet .party-table { margin: 0 0 12px !important; padding-bottom: 12px !important; }
  .doc-sheet .meta-table td { padding: 12px 14px !important; }
  .doc-sheet .items th,
  .doc-sheet .items td { padding: 10px 12px !important; }
  .doc-sheet .totals td { padding: 8px 12px !important; }
  .doc-sheet .totals .grand td,
  .doc-sheet .totals .balance td { padding: 10px 12px !important; }
  .doc-sheet .doc-notes { margin-top: 10px !important; }
  .doc-sheet .note-block { margin-bottom: 8px !important; }
  .doc-sheet .note-block + .note-block { margin-top: 16px !important; }
  .doc-sheet .note-label { margin-top: 2px !important; margin-bottom: 8px !important; }
  .doc-sheet .bottom td { padding-top: 6px !important; }
  .doc-sheet .sign-customer-space { height: 32px !important; }
  .doc-sheet .thanks { margin-top: 6px !important; margin-bottom: 0 !important; }

  .print-letterhead-header { display: none !important; }
  .print-letterhead-footer {
    display: block !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    height: auto !important;
    background: #fff !important;
    color: #103860 !important;
    z-index: 9999 !important;
    text-align: center !important;
    padding: 0 !important;
    transform: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-letterhead-rules {
    height: 0 !important;
    border-top: 2px solid #c8a850 !important;
    border-bottom: 0 !important;
    margin: 0 0 1.5mm !important;
  }
  .print-letterhead-footer .doc-contact {
    font-size: 7.5px !important;
    font-weight: 700 !important;
    color: #103860 !important;
    white-space: normal !important;
  }
  .print-letterhead-footer .doc-contact-item {
    display: inline-block !important;
    padding: 0 6px !important;
    color: #103860 !important;
  }
  .print-letterhead-footer .doc-contact-item + .doc-contact-item {
    border-left: 1.5px solid #c8a850 !important;
  }
  .print-letterhead-footer .doc-contact-item svg {
    width: 8px !important;
    height: 8px !important;
    vertical-align: -1px !important;
    margin-right: 2px !important;
  }
}

/* Screen: letterhead chrome is print-only */
.print-letterhead-header,
.print-letterhead-footer {
  display: none;
}

@media (min-width: 992px) {
  html.sidebar-collapsed { --sidebar-w: 76px; }
  html.sidebar-collapsed .sidebar {
    overflow: hidden;
  }
  html.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 16px 8px 14px;
  }
  html.sidebar-collapsed .sidebar-brand .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  html.sidebar-collapsed .brand-text,
  html.sidebar-collapsed .nav-text {
    display: none;
  }
  html.sidebar-collapsed .nav-label {
    width: 18px;
    height: 3px;
    padding: 0;
    margin: 14px auto 8px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
    background: var(--gold-500);
    opacity: .5;
    border-radius: 99px;
  }
  html.sidebar-collapsed .sidebar-nav {
    padding: 6px 0 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  html.sidebar-collapsed .sidebar-nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
  html.sidebar-collapsed .sidebar a.nav-link {
    width: 44px;
    height: 44px;
    margin: 0 auto 4px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }
  html.sidebar-collapsed .sidebar a.nav-link i { font-size: 17px; width: auto; }
  html.sidebar-collapsed .sidebar a.nav-link:hover {
    background: var(--sb-hover);
  }
  html.sidebar-collapsed .sidebar a.nav-link.active {
    box-shadow: 0 0 0 1.5px var(--gold-500);
  }
  html.sidebar-collapsed .sidebar-collapse {
    width: 38px;
    height: 38px;
    margin: 8px auto 16px;
    padding: 0;
    justify-content: center;
    border: 1px solid var(--gold-500);
    border-radius: 50%;
    background: var(--sb-hover);
  }
  html.sidebar-collapsed .sidebar-collapse:hover {
    background: var(--sb-active);
    color: var(--sb-text);
  }
  html.sidebar-collapsed .sidebar-collapse i { width: auto; font-size: 15px; }
}

.rpt-hero .dash-kicker a { color: var(--gold-400); text-decoration: none; }
.rpt-hero .dash-kicker a:hover { color: #fff; }
.rpt-hero .page-actions { margin: 0; }
.rpt-hero .dash-hero-copy p { max-width: 46rem; }
.rpt-hero .btn-outline-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}
.rpt-hero .btn-outline-light:hover,
.rpt-hero .btn-outline-light:focus {
  color: #1a1a1a;
  background: #fff;
  border-color: #fff;
}
.rpt-fy-launch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(200, 168, 80, 0.4);
  color: #fff;
  text-decoration: none;
}
.rpt-fy-launch:hover { color: #fff; border-color: var(--gold-400); background: rgba(200, 168, 80, 0.14); }
.rpt-fy-launch-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(200, 168, 80, 0.2);
  color: var(--gold-400);
  font-size: 1.2rem;
}
.rpt-fy-launch strong { display: block; font-size: 14px; }
.rpt-fy-launch small { display: block; color: #c5d0dc; font-size: 12px; }
.rpt-fy-launch > i { margin-left: auto; color: var(--gold-400); }
.rpt-fy-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rpt-fy-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--navy-800);
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  text-decoration: none;
}
.rpt-fy-chip:hover { color: var(--navy-800); border-color: var(--gold-500); }
.rpt-fy-chip.is-active {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}
.theme-dark .rpt-fy-chip { color: #d7e2ec; }
.theme-dark .rpt-fy-chip.is-active { color: #fff; }
.rpt-rules {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.rpt-rules li + li { margin-top: 8px; }
.rpt-section { margin-top: 22px; }
.rpt-section > header { margin-bottom: 12px; }
.rpt-section h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .rpt-section h2 { color: #fff; }
.rpt-section header p { margin: 0; color: var(--muted); font-size: 13px; }
.rpt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.rpt-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  min-height: 168px;
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.rpt-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--navy-800);
}
.rpt-card.tone-gold::before { background: var(--gold-500); }
.rpt-card.tone-teal::before { background: var(--navy-600); }
.rpt-card.tone-rose::before { background: #c45c4a; }
.rpt-card.tone-green::before { background: #2a9a62; }
.rpt-card.is-featured {
  background: linear-gradient(180deg, #103860, #0a2744);
  color: #fff;
  border-color: rgba(200, 168, 80, 0.4);
}
.rpt-card.is-featured strong { color: #fff; }
.rpt-card.is-featured span:not(.rpt-card-icon) { color: #d7e2ec; }
.rpt-card.is-featured em { color: var(--gold-400); }
.rpt-card:hover {
  color: inherit;
  transform: translateY(-3px);
  border-color: var(--gold-500);
  box-shadow: 0 16px 32px rgba(16, 56, 96, 0.14);
}
.rpt-card.is-featured:hover,
.rpt-card.is-featured:focus {
  color: #fff;
  background: linear-gradient(180deg, #185880, #103860);
  border-color: var(--gold-500);
}
.rpt-card.is-featured:hover strong,
.rpt-card.is-featured:focus strong { color: #fff; }
.rpt-card.is-featured:hover span:not(.rpt-card-icon),
.rpt-card.is-featured:focus span:not(.rpt-card-icon) { color: #eef3f8; }
.rpt-card.is-featured:hover em,
.rpt-card.is-featured:focus em { color: var(--gold-400); }
.rpt-card-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(16, 56, 96, 0.08);
  color: var(--navy-800);
  font-size: 1.15rem;
}
.rpt-card.tone-gold .rpt-card-icon { background: rgba(200, 168, 80, 0.18); color: var(--gold-700); }
.rpt-card.tone-teal .rpt-card-icon { background: rgba(32, 120, 168, 0.14); color: var(--navy-600); }
.rpt-card.tone-rose .rpt-card-icon { background: rgba(196, 92, 74, 0.14); color: #c45c4a; }
.rpt-card.tone-green .rpt-card-icon { background: rgba(42, 154, 98, 0.14); color: #2a9a62; }
.theme-dark .rpt-card-icon {
  background: rgba(126, 180, 220, 0.16);
  color: #9ec8ea;
}
.theme-dark .rpt-card.tone-gold .rpt-card-icon {
  background: rgba(200, 168, 80, 0.22);
  color: var(--gold-400);
}
.theme-dark .rpt-card.tone-teal .rpt-card-icon {
  background: rgba(80, 170, 214, 0.2);
  color: #7ec8e8;
}
.theme-dark .rpt-card.tone-rose .rpt-card-icon {
  background: rgba(196, 92, 74, 0.22);
  color: #f0a090;
}
.theme-dark .rpt-card.tone-green .rpt-card-icon {
  background: rgba(42, 154, 98, 0.22);
  color: #6fd4a0;
}
.rpt-card.is-featured .rpt-card-icon { background: rgba(200, 168, 80, 0.2); color: var(--gold-400); }
.rpt-card strong { font-size: 1rem; font-weight: 800; letter-spacing: -0.02em; }
.rpt-card > span:not(.rpt-card-icon) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  flex: 1;
}
.rpt-card em {
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-700);
}
.rpt-pairs > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.rpt-pairs > div:last-child { border-bottom: 0; }
.rpt-pairs span { color: var(--muted); }
.rpt-months { display: flex; flex-direction: column; gap: 8px; }
.rpt-month {
  display: grid;
  grid-template-columns: 72px 1fr 150px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.rpt-month-bars {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.theme-dark .rpt-month-bars { background: #1b242e; }
.rpt-month-bars i, .rpt-month-bars b {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  font-style: normal;
}
.rpt-month-bars i { background: #2a9a62; opacity: .85; }
.rpt-month-bars b { background: #c45c4a; opacity: .55; }
.rpt-month small { text-align: right; color: var(--muted); white-space: nowrap; }
.theme-dark .rpt-card { background: #151c24; }
.theme-dark .rpt-card.is-featured { background: linear-gradient(180deg, #185880, #103860); }

@media (max-width: 991px) {
  .rpt-fy-launch { min-width: 0; }
  .rpt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .sidebar {
    width: min(300px, calc(100vw - 44px));
    transform: translateX(-110%);
    transition: transform .22s ease, box-shadow .22s ease;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: none;
  }
  .sidebar.open {
    transform: none;
    box-shadow: 16px 0 40px rgba(8, 28, 48, 0.28);
  }
  .sidebar-collapse { display: none; }
  .main { margin-left: 0; width: 100%; }
  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 28, 48, 0.45);
    z-index: 35;
  }
  body.nav-open { overflow: hidden; }

  .topbar { gap: 10px; }
  .topbar-actions { gap: 6px; }
  .icon-btn.topbar-search-btn { display: inline-flex !important; }
  .topbar.is-search-open .topbar-search {
    display: block;
    position: absolute;
    left: 10px;
    right: 10px;
    top: calc(100% + 8px);
    max-width: none;
    z-index: 45;
  }
  .topbar-now-weather { display: none; }
  .content { padding: 16px 14px 24px; }
  .app-footer { padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-head h1 { font-size: 1.4rem; }
  .page-actions { width: 100%; }
  .page-actions .btn,
  .page-actions form { flex: 1 1 calc(50% - 8px); }
  .page-actions form .btn { width: 100%; }

  .dash-hero { padding: 20px 16px; border-radius: 16px; }
  .dash-hero h1 { font-size: 1.5rem; }
  .dash-range { align-items: stretch; width: 100%; }
  .reminder-hero { padding: 16px; gap: 14px; }
  .reminder-hero-when { font-size: 1.4rem; }
  .settings-card-head { flex-wrap: wrap; }
  .settings-card-body { padding: 14px; }
  .doc-sheet { padding: 16px 12px; min-height: 0; }
  .doc-sheet .doc-footer {
    width: calc(100% + 24px);
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .doc-sheet .doc-logo img { height: 52px; max-width: 160px; }
  .staff-dep-dialog .staff-dep-card {
    max-height: min(92dvh, 820px);
    padding: 18px 16px 14px;
  }
  .staff-dep-actions { justify-content: stretch; }
  .staff-dep-actions .btn { flex: 1 1 calc(50% - 8px); }
}

@media (max-width: 768px) {
  .form-control, .form-select, textarea.form-control {
    font-size: 16px;
    min-height: 48px;
  }
  .form-control-sm, .form-select-sm {
    font-size: 16px;
    min-height: 44px;
  }
  .card-soft.p-4 { padding: 1rem !important; }
  .dt-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .dt-footer .pagination {
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0;
  }
  .profile-theme { grid-template-columns: 1fr; }
  .perm-toolbar { flex-wrap: wrap; }
  .kpi .value { font-size: 1.2rem; overflow-wrap: anywhere; }
  .dash-kpi { min-height: 0; }
  .dash-kpi-value { overflow-wrap: anywhere; }
}

@media (max-width: 575px) {
  .rpt-grid { grid-template-columns: 1fr; }
  .rpt-month { grid-template-columns: 1fr; gap: 4px; }
  .rpt-month small { text-align: left; }

  .topbar-now-clock { display: none; }
  .page-actions .btn,
  .page-actions form { flex: 1 1 100%; }
  .role-card-actions { flex-wrap: wrap; }
  .role-card-actions .btn { flex: 1 1 calc(50% - 6px); }
  .role-card-actions .btn-navy { flex: 1 1 100%; }
  .reminder-hero-mark { width: 52px; height: 52px; font-size: 22px; border-radius: 14px; }
  .doc-sheet .party-table,
  .doc-sheet .party-table tbody,
  .doc-sheet .party-table tr,
  .doc-sheet .party-table td {
    display: block;
    width: 100%;
  }
  .doc-sheet .party-table td.party-to {
    text-align: left;
    margin-top: 16px;
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid var(--border);
  }
  .doc-sheet .party-table td.party-from { padding-right: 0; }
  .doc-sheet .party-to .party-contact { justify-content: flex-start; }
  .app-dialog {
    align-items: flex-end;
    padding: 0;
  }
  .app-dialog-card {
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .app-dialog-actions .btn { flex: 1; min-width: 0; }
  .toast-stack {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .icon-btn { width: 36px; height: 36px; }
  .role-card-actions .btn { flex: 1 1 100%; }
  .settings-tab { min-width: 108px; padding: 8px 10px; }
}

@media (hover: none) {
  .dash-kpi:hover,
  a.card-soft:hover {
    transform: none;
  }
}

.settle-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.settle-item {
  background: #f4f7fb;
  border-radius: 12px;
  padding: 12px 14px;
}
.theme-dark .settle-item { background: rgba(255,255,255,0.06); }
.settle-item .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.settle-item .value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .settle-item .value { color: #fff; }
.settle-item.is-due .value { color: #b45309; }
.settle-item.is-settled .value { color: #1f7a4d; }
.settle-bar {
  height: 8px;
  background: #e6ebf2;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0 6px;
}
.theme-dark .settle-bar { background: rgba(255,255,255,0.12); }
.settle-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #103860, #E8C85C);
}
@media (max-width: 700px) {
  .settle-strip { grid-template-columns: 1fr; }
}

.slot-picker-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}
.cal-weekbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}
.cal-week {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.cal-week-nav {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-800);
  background: #fff;
}
.theme-dark .cal-week-nav { background: rgba(255,255,255,0.04); color: #fff; }
.cal-daychip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2px;
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  box-sizing: border-box;
}
.theme-dark .cal-daychip { background: rgba(255,255,255,0.04); }
.cal-daychip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.theme-dark .cal-daychip em { color: #c5d0dc; }
.cal-daychip strong { font-size: 18px; color: var(--navy-800); }
.theme-dark .cal-daychip strong { color: #f0f5fa; }
.cal-daychip span {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 1;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: #103860;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
.theme-dark .cal-daychip span {
  background: var(--gold-500);
  color: #181d23;
  box-shadow: 0 0 0 2px #1a222c;
}
.cal-daychip span.cal-needs-chip {
  background: #b42318;
  color: #fff;
}
.theme-dark .cal-daychip span.cal-needs-chip {
  background: #c4453c;
  color: #fff;
}
.cal-daychip.is-today { box-shadow: 0 0 0 3px rgba(232, 200, 92, 0.28); }
.cal-daychip.is-selected {
  border-color: #c8a850;
  background: #fffbeb;
}
.cal-daychip.is-selected em,
.cal-daychip.is-selected strong {
  color: var(--navy-800);
}
.theme-dark .cal-daychip.is-selected {
  background: rgba(232, 200, 92, 0.22);
  border-color: var(--gold-500);
  box-shadow: inset 0 0 0 1px rgba(232, 200, 92, 0.35);
}
.theme-dark .cal-daychip.is-selected em {
  color: #f3d76e;
}
.theme-dark .cal-daychip.is-selected strong {
  color: #fff;
}
.cal-daychip.is-off { opacity: .55; }
.theme-dark .cal-daychip.is-off {
  opacity: .7;
}
.theme-dark .cal-daychip.is-off em,
.theme-dark .cal-daychip.is-off strong {
  color: #9aa8b5;
}
.cal-daynav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 700;
}
.cal-daynav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.cal-daynav-hint {
  margin: 0;
  flex: 1 1 220px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}
.cal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .9fr);
  gap: 18px;
  align-items: start;
}
.cal-board {
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100dvh - 220px));
  min-height: 280px;
}
.cal-board > .settings-card-head {
  flex: 0 0 auto;
}
.cal-board > .settings-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.cal-slot-row.is-now,
.cal-table tr.is-now {
  scroll-margin-top: 8px;
}
.cal-timeline {
  position: relative;
  min-height: 0;
  background: none;
}
.cal-timeline-stack {
  padding: 4px 0 8px;
}
.cal-slot-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-slot-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 48px;
}
.cal-slot-row.is-event {
  min-height: 0;
  align-items: flex-start;
}
.cal-slot-row.is-free {
  min-height: 48px;
}
.cal-event-lane {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}
.cal-slot-time {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 10px;
  text-align: right;
}
.cal-slot-time strong {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy-800);
  line-height: 1.2;
}
.cal-slot-time span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}
.theme-dark .cal-slot-time strong { color: #f2f6fa; }
.cal-event-card {
  display: flex;
  align-items: stretch;
  flex: 1 1 0;
  min-width: 0;
  min-height: calc(72px + (var(--cal-blocks, 1) - 1) * 52px);
  border-radius: 14px;
  background: #103860;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(16, 56, 96, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.cal-event-card.is-meeting,
.cal-event-card.is-demo { background: #8a6d1f; box-shadow: 0 8px 22px rgba(138, 109, 31, 0.22); }
.cal-event-card.is-call { background: #103860; }
.cal-event-card.is-email { background: #3d5a73; }
.cal-event-card .cal-event-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
}
.cal-event-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  font-size: 16px;
}
.cal-event-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.cal-event-copy strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.3;
  word-break: break-word;
}
.cal-event-copy small {
  display: block;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12.5px;
  line-height: 1.4;
}
.cal-event-copy em {
  display: inline-block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}
.cal-event-card .cal-event-reschedule {
  flex: 0 0 auto;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  padding: 0 14px;
  cursor: pointer;
}
.cal-event-card .cal-event-reschedule:hover {
  background: rgba(255, 255, 255, 0.26);
}
.cal-slot-free {
  width: 100%;
  min-height: 48px;
  border: 1px dashed rgba(16, 56, 96, 0.4);
  background: rgba(232, 200, 92, 0.1);
  border-radius: 12px;
  color: #103860;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.cal-slot-free span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-slot-free:hover {
  background: rgba(232, 200, 92, 0.32);
  border-color: #E8C85C;
  color: var(--navy-800);
  transform: translateY(-1px);
}
.cal-slot-muted {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f7f9fb;
  color: #8a96a3;
  font-size: 12.5px;
  font-weight: 650;
}
.cal-slot-row.is-past { opacity: 0.72; }
.theme-dark .cal-slot-free {
  background: rgba(232, 200, 92, 0.1);
  border-color: rgba(232, 200, 92, 0.45);
  color: #f4e7b0;
}
.theme-dark .cal-slot-free:hover {
  background: rgba(232, 200, 92, 0.22);
  color: #f4e7b0;
}
.theme-dark .cal-slot-muted {
  background: rgba(255, 255, 255, 0.04);
  border-color: #3d4c5c;
  color: #9aa8b5;
}
.cal-ticks { position: absolute; inset: 0; }
.cal-tick {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed #d7e0ea;
}
.cal-tick span {
  position: absolute;
  left: 0;
  top: -8px;
  width: 48px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.cal-lane { position: relative; margin-left: 56px; min-height: 520px; cursor: crosshair; }
.cal-event {
  position: absolute;
  left: 8px;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: 10px;
  background: #103860;
  color: #fff;
  overflow: hidden;
  min-height: 44px;
  cursor: default;
}
.cal-event-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  color: inherit;
  text-decoration: none;
}
.cal-event strong, .cal-event small { display: block; color: #fff; }
.cal-event small { opacity: .85; font-size: 12px; }
.cal-event.is-meeting, .cal-event.is-demo { background: #8a6d1f; }
.cal-event.is-call { background: #103860; }
.cal-event.is-email { background: #3d5a73; }
.cal-event-reschedule {
  flex: 0 0 auto;
  border: 0;
  background: rgba(255,255,255,0.16);
  color: inherit;
  padding: 0 10px;
  cursor: pointer;
}
.cal-event-reschedule:hover {
  background: rgba(255,255,255,0.28);
}
.cal-todos { list-style: none; margin: 0; padding: 0; }
.cal-todos li { border-top: 1px solid var(--border); }
.cal-todos li:first-child { border-top: 0; }
.cal-todos a:not(.btn), .avail-exc {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
}
.cal-todos a:not(.btn):hover { background: #f7fafc; }
.theme-dark .cal-todos a:not(.btn):hover { background: rgba(255,255,255,0.04); }
.cal-todos strong { display: block; color: var(--navy-800); font-size: 14px; }
.theme-dark .cal-todos strong { color: #fff; }
.cal-todos small { display: block; margin-top: 3px; color: var(--muted); }
.cal-todos small.is-overdue { color: #b42318; font-weight: 700; }
.theme-dark .cal-todos small.is-overdue { color: #f2b8b5; }
.cal-needs {
  border-left: 4px solid var(--gold-500);
}
.cal-needs .settings-card-head h2 { color: var(--navy-800); }
.theme-dark .cal-needs .settings-card-head h2 { color: #fff; }
.cal-needs .settings-card-head p { color: var(--muted); }
.theme-dark .cal-needs .settings-card-head p { color: #c5d0da; }
.cal-needs-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-needs-row > a {
  padding-bottom: 0;
}
.cal-needs-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}
.cal-needs-actions .btn {
  display: inline-flex;
}
.cal-daychip.has-needs { position: relative; }
.cal-needs-chip {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #b42318;
  color: #fff !important;
  font-size: 10px;
  font-weight: 800;
}
.theme-dark .cal-needs-chip { background: #c4453c; color: #fff !important; }
.avail-grid { display: grid; gap: 8px; }
.avail-head, .avail-row {
  display: grid;
  grid-template-columns: 1.2fr .7fr 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.avail-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px 6px;
}
.avail-row {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.theme-dark .avail-row { background: rgba(255,255,255,0.04); }
.avail-check { display: flex; justify-content: center; }
.avail-exc { width: 100%; justify-content: space-between; align-items: center; }
@media (max-width: 991px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-board {
    max-height: min(560px, calc(100dvh - 200px));
  }
  .avail-head { display: none; }
  .avail-row { grid-template-columns: 1fr 1fr; }
  .avail-row strong { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  .cal-board {
    max-height: min(480px, calc(100dvh - 180px));
  }
  .cal-weekbar {
    gap: 6px;
  }
  .cal-week-nav {
    width: 34px;
    height: 34px;
  }
  .cal-week {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 2px 2px 6px;
    scrollbar-width: thin;
  }
  .cal-week::-webkit-scrollbar {
    height: 4px;
  }
  .cal-daychip {
    flex: 0 0 auto;
    width: 52px;
    min-width: 52px;
    padding: 8px 4px;
    scroll-snap-align: start;
  }
  .cal-daychip em {
    font-size: 10px;
    letter-spacing: 0.02em;
    line-height: 1.1;
    width: 100%;
    text-align: center;
  }
  .cal-daychip strong {
    font-size: 16px;
    line-height: 1.15;
    width: 100%;
    text-align: center;
  }
  .cal-daychip span {
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    padding: 0 4px;
  }
  .cal-daynav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
  }
  .cal-daynav-links {
    gap: 14px;
  }
  .cal-daynav-hint {
    flex: none;
    width: 100%;
    max-width: none;
  }
  .cal-slot-row {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }
  .cal-slot-time {
    padding-top: 8px;
  }
  .cal-slot-time strong {
    font-size: 11px;
  }
  .cal-event-card .cal-event-main {
    gap: 10px;
    padding: 12px;
  }
  .cal-event-copy strong {
    font-size: 14px;
  }
  .cal-view-toggle {
    width: 100%;
  }
  .cal-view-toggle .btn {
    flex: 1 1 0;
  }
}
.fu-flag-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.fu-flag-banner i { font-size: 1.35rem; margin-top: 2px; }
.fu-flag-banner strong { display: block; font-size: 15px; }
.fu-flag-banner p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.fu-flag-banner.is-stop { background: #fdecec; border-color: #f3b4b4; color: #8a1f1f; }
.fu-flag-banner.is-stop p { color: #8a1f1f; }
.fu-flag-banner.is-warn { background: #fff6e5; border-color: #efd09a; color: #7a4b00; }
.fu-flag-banner.is-warn p { color: #7a4b00; }
.fu-flag-banner.is-good { background: #eef7ee; border-color: #b7dfb8; color: #1f6b32; }
.fu-flag-banner.is-good p { color: #1f6b32; }
.fu-thread { display: grid; gap: 10px; }
.fu-thread-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f7f9fc;
}
.fu-thread-item.is-current {
  background: #fff;
  border-color: #103860;
  box-shadow: 0 0 0 1px #103860 inset;
}
.fu-thread-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-bottom: 6px; }
.fu-thread-meta strong { color: var(--navy-800, #103860); }
.fu-thread-meta span { color: var(--muted); font-size: 12px; font-weight: 650; }
.fu-thread-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fu-thread-open, .fu-thread-now {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}
.fu-thread-now { color: var(--muted); }
.theme-dark .fu-flag-banner { background: #151c26; }
.theme-dark .fu-flag-banner.is-stop { background: #3a1a1a; border-color: #7a3030; color: #ffd0d0; }
.theme-dark .fu-flag-banner.is-stop p { color: #ffd0d0; }
.theme-dark .fu-flag-banner.is-warn { background: #2c2414; border-color: #7a6230; color: #f3d9a0; }
.theme-dark .fu-flag-banner.is-warn p { color: #f3d9a0; }
.theme-dark .fu-flag-banner.is-good { background: #17301d; border-color: #2f6b3c; color: #c6ebcc; }
.theme-dark .fu-flag-banner.is-good p { color: #c6ebcc; }
.theme-dark .fu-thread-item { background: rgba(255,255,255,0.04); }
.theme-dark .fu-thread-item.is-current { background: #151c26; }
.theme-dark .fu-thread-meta strong { color: #fff; }

.cal-view-toggle { display: inline-flex; gap: 6px; }
.cal-slot {
  position: absolute;
  left: 4px;
  right: 8px;
  z-index: 2;
  border: 1px dashed rgba(16, 56, 96, 0.45);
  background: rgba(232, 200, 92, 0.12);
  border-radius: 10px;
  color: #103860;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.cal-slot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-slot:hover {
  background: rgba(232, 200, 92, 0.38);
  border-color: #E8C85C;
  color: var(--navy-800);
  transform: translateY(-1px);
}
.theme-dark .cal-slot {
  background: rgba(232, 200, 92, 0.1);
  border-color: rgba(232, 200, 92, 0.45);
  color: #f4e7b0;
}
.theme-dark .cal-slot:hover {
  background: rgba(232, 200, 92, 0.22);
  color: #f4e7b0;
}
.cal-lane-empty {
  position: absolute;
  inset: 18% 12px auto;
  z-index: 1;
  text-align: center;
  padding: 18px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  border: 1px dashed var(--border);
}
.cal-lane-empty.is-static {
  position: relative;
  inset: auto;
  margin: 0 0 14px;
}
.cal-lane-empty p {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
}
.theme-dark .cal-lane-empty {
  background: rgba(21, 28, 38, 0.92);
}
.cal-table tr.is-free td { background: rgba(232, 200, 92, 0.08); }
.cal-table tr.is-event td {
  background: rgba(16, 56, 96, 0.04);
  color: inherit;
  opacity: 1;
}
.cal-table tr.is-event td strong {
  color: #103860;
  font-weight: 700;
}
.cal-table tr.is-past td {
  color: #8a96a3;
  background: #f7f9fb;
  opacity: 1;
}
.cal-table .btn-navy,
.cal-table .btn-gold {
  opacity: 1;
}
.theme-dark .cal-table tr.is-event td {
  background: rgba(232, 200, 92, 0.08);
}
.theme-dark .cal-table tr.is-event td strong { color: #f4e7b0; }
.theme-dark .cal-table tr.is-past td {
  color: #9aa6b4;
  background: rgba(255,255,255,0.03);
}
.cal-quick-dialog .cal-quick-card {
  max-width: 560px;
  width: calc(100% - 32px);
  text-align: left;
}
.cal-quick-when { margin: 0 0 12px; color: var(--muted); font-weight: 650; }
.cal-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cal-kind label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}
.cal-kind input { margin: 0; }
.cal-kind label:has(input:checked) {
  background: #103860;
  color: #fff;
  border-color: #103860;
}
.theme-dark .cal-kind label:has(input:checked) { background: #E8C85C; color: #103860; border-color: #E8C85C; }

.enquiry-picker {
  position: relative;
}
.enquiry-picker-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.enquiry-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}
.enquiry-picker-trigger .enquiry-picker-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.enquiry-picker-trigger .enquiry-picker-when,
.enquiry-picker-option .enquiry-picker-when {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted, #6c757d);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.enquiry-picker-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(16, 56, 96, 0.14);
}
.enquiry-picker-menu.is-fixed {
  position: fixed;
  right: auto;
  z-index: 2200;
}
.enquiry-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.enquiry-picker-option .enquiry-picker-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.enquiry-picker-option:hover,
.enquiry-picker-option.is-selected {
  background: rgba(16, 56, 96, 0.08);
}
.theme-dark .enquiry-picker-menu {
  background: #151c26;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.theme-dark .enquiry-picker-option:hover,
.theme-dark .enquiry-picker-option.is-selected {
  background: rgba(232, 200, 92, 0.14);
}

.fu-behaviour {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 160px;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 12px;
  background: #f7f9fc;
  text-align: right;
}
.fu-behaviour-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #6c757d);
}
.fu-behaviour strong {
  font-size: 13px;
  line-height: 1.3;
  color: #103860;
}
.fu-behaviour.is-positive,
.fu-behaviour.is-interested {
  background: #eef7ee;
  border-color: #b7dfb8;
}
.fu-behaviour.is-positive strong,
.fu-behaviour.is-interested strong { color: #1f6b32; }
.fu-behaviour.is-callback,
.fu-behaviour.is-no_response,
.fu-behaviour.is-not_interested {
  background: #fff6e5;
  border-color: #efd09a;
}
.fu-behaviour.is-callback strong,
.fu-behaviour.is-no_response strong,
.fu-behaviour.is-not_interested strong { color: #7a4b00; }
.fu-behaviour.is-bad_behaviour,
.fu-behaviour.is-do_not_contact {
  background: #fdecec;
  border-color: #f3b4b4;
}
.fu-behaviour.is-bad_behaviour strong,
.fu-behaviour.is-do_not_contact strong { color: #8a1f1f; }
.fu-enquiry-notes {
  padding: 12px 14px;
  border: 1px dashed var(--border, #d7dee8);
  border-radius: 12px;
  background: #fbfcfe;
}
.fu-enquiry-notes strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #103860;
}
.fu-enquiry-notes p {
  margin: 6px 0 0;
  color: var(--muted, #5b6b7c);
  white-space: pre-wrap;
  font-size: 13px;
}
.fu-enquiry-req {
  margin-top: 8px !important;
  font-weight: 650;
  color: #103860 !important;
}
.cal-quick-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.cal-quick-head h3 { margin: 0; }
.theme-dark .fu-behaviour {
  background: #151c26;
  border-color: rgba(255,255,255,0.12);
}
.theme-dark .fu-behaviour strong { color: #f4e7b0; }
.theme-dark .fu-enquiry-notes {
  background: #151c26;
  border-color: rgba(255,255,255,0.12);
}
.theme-dark .fu-enquiry-notes strong,
.theme-dark .fu-enquiry-req { color: #f4e7b0 !important; }

.contact-repeater {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.contact-repeater-add {
  align-self: flex-start;
}
.contact-card {
  padding: 14px 16px 16px;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 48%);
}
.contact-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.contact-card-head strong {
  display: block;
  color: #103860;
  font-size: 14px;
}
.contact-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #6c757d);
  cursor: pointer;
}
.theme-dark .contact-card {
  background: linear-gradient(180deg, #1a2330 0%, #151c26 55%);
  border-color: rgba(255,255,255,0.12);
}
.theme-dark .contact-card-head strong { color: #f4e7b0; }

.reminder-alert-dialog .reminder-alert-card {
  max-width: 440px;
  text-align: center;
}
.reminder-alert-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #103860;
  color: #E8C85C;
  font-size: 1.5rem;
}
.reminder-alert-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6c757d);
}
.reminder-alert-card h3 {
  margin: 6px 0 4px;
  color: #103860;
}
.reminder-alert-when {
  margin: 0 0 8px;
  font-weight: 700;
  color: #103860;
}
.reminder-alert-notes {
  margin: 0 0 14px;
  color: var(--muted, #6c757d);
  font-size: 14px;
}
.reminder-alert-snooze {
  text-align: left;
  margin-bottom: 12px;
}
.reminder-alert-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.reminder-alert-actions .btn {
  width: 100%;
}
.reminder-alert-queue {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted, #6c757d);
}
.theme-dark .reminder-alert-card h3,
.theme-dark .reminder-alert-when { color: #f4e7b0; }

.behaviour-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.behaviour-tag i { font-size: 14px; }
.behaviour-tag.is-warn {
  background: #fff1d6;
  border-color: #efc56a;
  color: #7a4b00;
}
.behaviour-tag.is-stop {
  background: #fde4e4;
  border-color: #e89a9a;
  color: #8a1f1f;
}
.behaviour-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
}
.behaviour-banner i {
  font-size: 1.25rem;
  margin-top: 2px;
}
.behaviour-banner strong {
  display: block;
  font-size: 15px;
}
.behaviour-banner p {
  margin: 2px 0 0;
  font-size: 13px;
}
.behaviour-banner.is-warn {
  background: #fff6e5;
  border-color: #efd09a;
  color: #7a4b00;
}
.behaviour-banner.is-warn p { color: #7a4b00; }
.behaviour-banner.is-stop {
  background: #fdecec;
  border-color: #f3b4b4;
  color: #8a1f1f;
}
.behaviour-banner.is-stop p { color: #8a1f1f; }
.theme-dark .behaviour-tag.is-warn {
  background: #3a2e14;
  border-color: #7a6230;
  color: #f3d9a0;
}
.theme-dark .behaviour-tag.is-stop {
  background: #3a1a1a;
  border-color: #7a3030;
  color: #ffd0d0;
}
.theme-dark .behaviour-banner.is-warn {
  background: #2c2414;
  border-color: #7a6230;
  color: #f3d9a0;
}
.theme-dark .behaviour-banner.is-warn p { color: #f3d9a0; }
.theme-dark .behaviour-banner.is-stop {
  background: #3a1a1a;
  border-color: #7a3030;
  color: #ffd0d0;
}
.theme-dark .behaviour-banner.is-stop p { color: #ffd0d0; }

/* Customer show: history stretches to match left stack height */
@media (min-width: 992px) {
  .customer-show-layout {
    align-items: stretch;
  }
  .customer-show-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .customer-show-main > .customer-history {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
  }
  .customer-show-main > .customer-history .settings-card-head,
  .customer-show-main > .customer-history .history-filters {
    flex-shrink: 0;
  }
  .customer-show-main > .customer-history .history-list {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 220px;
  }
  .customer-show-main > .customer-show-timeline {
    flex-shrink: 0;
    margin-top: 1rem;
  }
}

/* Customer loyalty + history */
.customer-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.loyalty-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(16, 56, 96, 0.08);
  color: #103860;
  border: 1px solid rgba(16, 56, 96, 0.14);
}
.loyalty-pill.is-active {
  background: rgba(232, 200, 92, 0.28);
  border-color: rgba(200, 168, 80, 0.55);
  color: #5c4a12;
}
.loyalty-pill.is-quiet {
  background: #f3f5f7;
  color: #3d4f63;
  border-color: #e2e7ec;
  font-weight: 700;
}
.theme-dark .loyalty-pill {
  background: rgba(232, 200, 92, 0.12);
  border-color: rgba(232, 200, 92, 0.28);
  color: #f0e2a8;
}
.theme-dark .loyalty-pill.is-quiet {
  background: #1a222b;
  color: #c5d0da;
  border-color: #2a3540;
}
.loyalty-card .loyalty-body { padding: 16px 18px 18px; }
.loyalty-years {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #103860;
  line-height: 1.1;
}
.theme-dark .loyalty-years { color: #f0e2a8; }
.loyalty-caption {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .loyalty-caption { color: #c5d0da; }
.loyalty-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(16, 56, 96, 0.08);
}
.theme-dark .loyalty-stats { border-top-color: #2a3540; }
.loyalty-stats span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3d4f63;
}
.theme-dark .loyalty-stats span { color: #c5d0da; }
.loyalty-stats strong {
  font-size: 15px;
  color: #103860;
}
.theme-dark .loyalty-stats strong { color: #e8eef4; }
.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 4px;
}
.history-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d7dee6;
  background: #fff;
  color: #345;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.history-filter span {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #eef2f6;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.history-filter:hover { border-color: #c8a850; color: #103860; }
.history-filter.is-active {
  background: #103860;
  border-color: #103860;
  color: #fff;
}
.history-filter.is-active span {
  background: rgba(232, 200, 92, 0.25);
  color: #f7e7a8;
}
.theme-dark .history-filter {
  background: #151b22;
  border-color: #2a3540;
  color: #d7e2ec;
}
.theme-dark .history-filter span { background: #243040; }
.theme-dark .history-filter.is-active {
  background: #1e4a74;
  border-color: #2f6aa0;
}
.history-list { padding: 8px 10px 14px; }
.history-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.history-row:hover {
  background: rgba(16, 56, 96, 0.04);
  border-color: rgba(16, 56, 96, 0.08);
  color: inherit;
}
.theme-dark .history-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: #2a3540;
}
.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(16, 56, 96, 0.08);
  color: #103860;
  font-size: 16px;
}
.theme-dark .history-icon {
  background: rgba(232, 200, 92, 0.12);
  color: #f0e2a8;
}
.history-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.history-main strong {
  font-size: 14px;
  color: #103860;
}
.theme-dark .history-main strong { color: #e8eef4; }
.history-main small {
  color: #3d4f63;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}
.history-meta em {
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
  color: #103860;
  font-variant-numeric: tabular-nums;
}
.theme-dark .history-meta em { color: #f0e2a8; }
.history-meta time {
  font-size: 12px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .history-main small,
.theme-dark .history-meta time { color: #c5d0da; }
.history-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
}
@media (max-width: 700px) {
  .history-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .history-meta {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }
}

.billing-reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.theme-dark .billing-reminder-actions { border-top-color: #2a3540; }
.billing-reminder-hint {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .billing-reminder-hint { color: #c5d0da; }
.billing-reminder-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(16, 56, 96, 0.08);
}
.theme-dark .billing-reminder-panel { border-top-color: #2a3540; }
.billing-reminder-status {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(16, 56, 96, 0.12);
  background: #f7f9fc;
  border-radius: 10px;
  padding: 10px 12px;
  color: inherit;
}
.billing-reminder-status.is-active {
  background: rgba(232, 200, 92, 0.18);
  border-color: rgba(200, 168, 80, 0.55);
}
.theme-dark .billing-reminder-status {
  background: #1a222b;
  border-color: #2a3540;
  color: #e8eef4;
}
.theme-dark .billing-reminder-status.is-active {
  background: rgba(232, 200, 92, 0.12);
  border-color: rgba(232, 200, 92, 0.35);
}
.billing-reminder-status-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #103860;
  color: #E8C85C;
  flex-shrink: 0;
}
.billing-reminder-status-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.billing-reminder-status-text strong {
  font-size: 13.5px;
  font-weight: 700;
}
.billing-reminder-status-text small {
  font-size: 12px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .billing-reminder-status-text small { color: #c5d0da; }
.billing-reminder-chevron {
  color: #7a8a99;
  transition: transform .15s ease;
}
.billing-reminder-status[aria-expanded="true"] .billing-reminder-chevron {
  transform: rotate(180deg);
}
.billing-reminder-body {
  margin-top: 12px;
}
.billing-reminder-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.billing-reminder-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 56, 96, 0.1);
  border-radius: 10px;
  background: #fff;
}
.theme-dark .billing-reminder-item {
  background: #151c26;
  border-color: #2a3540;
}
.billing-reminder-item.is-cancelled,
.billing-reminder-item.is-completed {
  opacity: 0.72;
}
.billing-reminder-item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.billing-reminder-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .billing-reminder-item-meta { color: #c5d0da; }
.billing-reminder-schedule h6 {
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 4px;
}
.billing-reminder-invoices {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  margin-bottom: 4px;
}
.billing-reminder-invoice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid rgba(16, 56, 96, 0.1);
  border-radius: 8px;
  margin: 0;
  cursor: pointer;
}
.theme-dark .billing-reminder-invoice { border-color: #2a3540; }
.billing-reminder-invoice span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.billing-reminder-invoice small {
  color: #3d4f63;
  font-size: 12px;
  font-weight: 600;
}
.theme-dark .billing-reminder-invoice small { color: #c5d0da; }

.pr-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(200, 168, 80, 0.55);
  background: rgba(232, 200, 92, 0.22);
  color: #5c4a12;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.pr-indicator:hover {
  background: rgba(232, 200, 92, 0.36);
  color: #5c4a12;
}
.pr-indicator-lg {
  padding: 7px 12px;
  font-size: 13px;
}
.theme-dark .pr-indicator {
  background: rgba(232, 200, 92, 0.14);
  border-color: rgba(232, 200, 92, 0.4);
  color: #f0e2a8;
}
.pr-modal[hidden] { display: none !important; }
.pr-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: grid;
  place-items: center;
  padding: 16px;
}
.pr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 36, 0.55);
}
.pr-modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(8, 28, 48, 0.28);
}
.theme-dark .pr-modal-card { background: #151c26; }
.pr-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.pr-modal-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.pr-modal-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--navy-800);
}
.theme-dark .pr-modal-head h3 { color: #f2f6fa; }
.pr-modal-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.pr-modal-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 0;
}
.pr-modal-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f6f9;
  font-size: 12px;
  font-weight: 700;
  color: #103860;
}
.theme-dark .pr-modal-chip {
  background: #1b2430;
  color: #e8eef4;
}
.pr-modal-body { padding: 12px 18px 18px; display: grid; gap: 10px; }
.pr-modal-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.pr-modal-item.is-cancelled,
.pr-modal-item.is-completed { opacity: 0.7; }
.pr-modal-item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.pr-modal-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.pr-modal-foot {
  padding: 0 18px 16px;
  display: flex;
  justify-content: flex-end;
}
body.pr-modal-open { overflow: hidden; }

.loyalty-pill.is-due {
  background: #fdecec;
  border-color: #f3b4b4;
  color: #8a1f1f;
}
.theme-dark .loyalty-pill.is-due {
  background: #3a1a1a;
  border-color: #7a3030;
  color: #ffd0d0;
}
.billing-card.has-due .settings-card-head {
  background: #fff6f4;
}
.theme-dark .billing-card.has-due .settings-card-head {
  background: #2a1818;
}
.billing-body { padding: 16px 18px 18px; }
.billing-due {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdecec;
  border: 1px solid #f3b4b4;
  margin-bottom: 14px;
}
.billing-due span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #8a1f1f;
}
.billing-due strong {
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #8a1f1f;
}
.billing-due small {
  font-size: 12px;
  color: #a33;
}
.theme-dark .billing-due {
  background: #3a1a1a;
  border-color: #7a3030;
}
.theme-dark .billing-due span,
.theme-dark .billing-due strong,
.theme-dark .billing-due small { color: #ffd0d0; }
.billing-clear {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(25, 135, 84, 0.08);
  color: #146c43;
  font-size: 13px;
  font-weight: 600;
}
.theme-dark .billing-clear {
  background: rgba(25, 135, 84, 0.16);
  color: #8fdfb5;
}
.billing-stats .is-due { color: #8a1f1f; }
.theme-dark .billing-stats .is-due { color: #ffd0d0; }
.billing-ratio-hint {
  display: block;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: #4a5d70;
  margin-top: 2px;
}
.theme-dark .billing-ratio-hint { color: #b8c6d2; }
.billing-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(16, 56, 96, 0.08);
  font-size: 13px;
  font-weight: 600;
  color: #3d4f63;
}
.theme-dark .billing-foot {
  border-top-color: #2a3540;
  color: #c5d0da;
}


/* Forced first-login password change */
.force-password-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.force-password-modal[hidden] { display: none !important; }
.force-password-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 28, 48, 0.55);
  backdrop-filter: blur(6px);
}
.force-password-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 20px;
  padding: 30px 26px 24px;
  text-align: center;
  border: 1px solid rgba(200, 168, 80, 0.22);
  box-shadow: 0 28px 64px rgba(8, 28, 48, 0.28);
  animation: appDialogIn 0.22s ease-out;
}
.force-password-badge {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: #103860;
  background: linear-gradient(145deg, rgba(200, 168, 80, 0.28), rgba(16, 56, 96, 0.08));
}
.force-password-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a7340;
}
.force-password-card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy-800);
}
.force-password-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.force-password-form { text-align: left; }
.force-password-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}
body.force-password-open { overflow: hidden; }
.theme-dark .force-password-card { background: #151c24; border-color: #3d4c5c; }
.theme-dark .force-password-card h2 { color: #f2f4f7; }

/* Multi SMTP accounts */
.smtp-account-list { display: flex; flex-direction: column; gap: 10px; }
.smtp-account-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
.smtp-account-row.is-off { opacity: 0.65; }
.smtp-account-actions { display: flex; gap: 6px; flex-shrink: 0; }
.smtp-account-form h3,
.smtp-account-form .h6 { color: var(--navy-800); }
.theme-dark .smtp-account-row { background: #1a222b; border-color: var(--border); }
.theme-dark .smtp-account-form h3,
.theme-dark .smtp-account-form .h6 {
  color: #fff !important;
}
.theme-dark .smtp-account-row strong { color: #fff; }
.theme-dark .smtp-account-row .text-muted,
.theme-dark .smtp-account-row .small {
  color: #c5d0da !important;
}

/* Settings: never leave navy / Bootstrap primary ink on dark panels */
.theme-dark .settings-card h2,
.theme-dark .settings-card h3,
.theme-dark .settings-card h4,
.theme-dark .settings-card .h3,
.theme-dark .settings-card .h4,
.theme-dark .settings-card .h5,
.theme-dark .settings-card .h6,
.theme-dark .settings-card-body h2,
.theme-dark .settings-card-body h3,
.theme-dark .settings-card-body h4,
.theme-dark .settings-card-body .h5,
.theme-dark .settings-card-body .h6 {
  color: #fff !important;
}
.theme-dark .settings-card .text-primary,
.theme-dark .settings-card a:not(.btn):not(.page-link):not(.nav-link) {
  color: var(--gold-400) !important;
}
.theme-dark .settings-card a:not(.btn):not(.page-link):not(.nav-link):hover {
  color: var(--gold-300) !important;
}
.theme-dark .settings-card .text-muted,
.theme-dark .settings-card .form-text,
.theme-dark .settings-card .small.text-muted {
  color: #c5d0da !important;
}
.theme-dark .settings-card .form-label,
.theme-dark .settings-card .form-check-label {
  color: #e8eef5 !important;
}

/* Data import wizard */
.import-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.import-hub-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.import-hub-card:hover {
  border-color: rgba(200, 168, 80, 0.55);
  box-shadow: 0 10px 28px rgba(8, 28, 48, 0.08);
  color: inherit;
}
.import-hub-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(200, 168, 80, 0.22), rgba(16, 56, 96, 0.08));
  color: #103860;
  font-size: 1.2rem;
}
.import-hub-card strong { font-size: 1.05rem; color: var(--navy-800); }
.import-hub-card span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.import-step {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f6;
  color: #6b7c8f;
}
.import-step.is-active {
  background: #103860;
  color: #fff;
}
.import-step.is-done {
  background: rgba(200, 168, 80, 0.22);
  color: #6a5520;
}
.import-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.import-panel h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--navy-800);
}
.import-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.import-panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.import-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.import-drop {
  flex: 1 1 280px;
  border: 1.5px dashed rgba(16, 56, 96, 0.28);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  color: #103860;
  font-weight: 600;
}
.import-drop input { display: none; }
.import-drop i { margin-right: 6px; }
.import-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.import-map-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
}
.import-map-row.is-required {
  border-color: rgba(200, 168, 80, 0.45);
  background: rgba(200, 168, 80, 0.06);
}
.import-map-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--navy-800);
}
.import-map-label em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8a7340;
}
.import-pill {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.import-pill.is-ok { background: #e7f7ed; color: #1b6b3a; }
.import-pill.is-bad { background: #fdecee; color: #9b1c2e; }
.import-preview-table tr.is-bad { background: #fff5f6; }
.import-preview-table tr.is-skip { background: #f4f6f8; opacity: .85; }
.import-preview-table tr.is-ok { background: #f6fbf8; }
.import-result-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}
.import-result-stats div {
  min-width: 90px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f4f7fa;
  text-align: center;
}
.import-result-stats strong { display: block; font-size: 1.4rem; color: var(--navy-800); }
.import-result-stats span { font-size: 12px; color: var(--muted); }
.import-error-list { margin: 0; padding-left: 18px; color: #9b1c2e; font-size: 13px; }
.theme-dark .import-hub-card,
.theme-dark .import-panel { background: #151c24; border-color: var(--border); color: var(--text); }
.theme-dark .import-drop,
.theme-dark .import-map-row,
.theme-dark .import-result-stats div { background: #1a222b; }
.theme-dark .import-hub-card strong,
.theme-dark .import-panel h2,
.theme-dark .import-map-label { color: #f2f4f7; }
.theme-dark .import-hub-card span,
.theme-dark .import-panel-head p { color: #c5d0da; }
.theme-dark .import-hub-icon {
  background: rgba(232, 200, 92, 0.14);
  color: var(--gold-400);
}
.theme-dark .import-step { background: #243039; color: #9aa8b5; }
.theme-dark .import-step.is-active { background: #c8a850; color: #103860; }

/* Listing column picker */
.listing-cols {
  position: relative;
  z-index: 6;
}
.listing-cols-menu {
  position: fixed;
  z-index: 2400;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 16px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 16px 40px rgba(8, 28, 48, 0.16);
  margin: 0;
  scrollbar-width: thin;
}
.listing-cols-menu[hidden] {
  display: none !important;
}
.listing-cols-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.listing-cols-hint {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #3d4f63;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}
.theme-dark .listing-cols-hint { color: #c5d0da; }
.listing-cols-group {
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.listing-cols-group:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* Pipeline board, activity, AMC, timesheets */
.view-toggle { display: inline-flex; gap: 6px; }
.pipe-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.pipe-stats > div,
.pipe-stats div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.pipe-stats span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.pipe-stats strong { font-size: 1.15rem; }
.pipe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.pipe-filters .form-control,
.pipe-filters .form-select { width: auto; min-width: 180px; }
.pipe-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: stretch;
}
.pipe-col {
  flex: 0 0 260px;
  background: rgba(16, 56, 96, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  max-height: min(72vh, 820px);
}
.pipe-col header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 8px;
  position: sticky;
  top: 0;
}
.pipe-col header h2 { font-size: var(--h6); margin: 0; font-weight: 700; }
.pipe-col header span {
  background: var(--card);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
}
.pipe-col-body {
  padding: 0 8px 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.pipe-col.is-drop .pipe-col-body { outline: 2px dashed var(--gold-600); outline-offset: -4px; border-radius: 10px; }
.pipe-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 8px; }
.pipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(16, 56, 96, 0.05);
  cursor: grab;
  transition: box-shadow .15s ease, opacity .15s ease, transform .15s ease;
}
.pipe-card:active { cursor: grabbing; }
.pipe-card.is-dragging { opacity: 0.4; }
.pipe-card.is-placed {
  animation: pipe-card-in .2s ease;
}
@keyframes pipe-card-in {
  from { opacity: 0.45; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.pipe-card-title { font-weight: 700; color: inherit; text-decoration: none; display: block; }
.pipe-card-title:hover { color: var(--navy-800); }
.pipe-card p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.pipe-meta { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.pipe-meta em { font-style: normal; font-weight: 700; font-size: 12px; }
.pipe-next { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pipe-next.is-overdue, .listing-next.is-overdue, .listing-next.is-missing { color: #b42318; font-weight: 600; }
.listing-next { font-size: 11px; margin-top: 4px; color: var(--muted); }
.pipe-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); }
.next-action-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold-600);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.next-action-banner.is-overdue { border-left-color: #b42318; }
.next-action-banner p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.next-action-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.comms-thread { display: flex; flex-direction: column; gap: 12px; }
.comms-form .form-text,
.comms-thread .text-muted {
  font-size: 13.5px;
  line-height: 1.45;
}
.comms-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.comms-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(16, 56, 96, 0.08);
  color: var(--navy-800);
}
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.bulk-bar .form-select { width: auto; min-width: 180px; }
.bulk-check { width: 36px; }
.theme-dark .pipe-col { background: rgba(255,255,255,0.04); }
.theme-dark .comms-icon { background: rgba(232, 200, 92, 0.12); color: var(--gold-400); }
@media (max-width: 767px) {
  .pipe-stats { grid-template-columns: 1fr; }
  .pipe-col { flex-basis: 82vw; }
  .next-action-banner { flex-direction: column; align-items: flex-start; }
}

.listing-cols-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  font-size: 13px;
  cursor: pointer;
  color: var(--navy-800);
}
.listing-cols-item input:disabled + span { opacity: 0.75; }
.listing-cols-apply { width: 100%; margin-top: 10px; }
.theme-dark .listing-cols-menu { background: #151c24; }
.theme-dark .listing-cols-item { color: #f2f4f7; }
.theme-dark .listing-cols-group { border-top-color: rgba(255,255,255,0.08); }

th.listing-col {
  white-space: nowrap;
  user-select: none;
}
th.listing-col .sort-link { display: inline; }
.listing-col-grip {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
  color: #3d4f63;
  cursor: grab;
  opacity: 0.5;
  vertical-align: -1px;
}
.listing-col-grip:active { cursor: grabbing; }
th.listing-col:hover .listing-col-grip,
th.listing-col.is-col-dragging .listing-col-grip { opacity: 1; }
th.listing-col.is-col-dragging { opacity: 0.45; }
th.listing-col.is-col-drop-before {
  box-shadow: inset 3px 0 0 var(--gold-600);
}
th.listing-col.is-col-drop-after {
  box-shadow: inset -3px 0 0 var(--gold-600);
}
.theme-dark .listing-col-grip { color: #c5d0da; }

.conversion-status {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.conversion-status.is-done {
  border-left: 4px solid #198754;
}
.conversion-status p { margin: 4px 0 0; color: var(--muted); }
.conversion-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.conversion-status-actions form { margin: 0; }

.doc-lock-btn {
  min-width: 40px;
  color: var(--navy-800);
}
.doc-lock-btn i { color: var(--navy-800); }
.theme-dark .doc-lock-btn,
.theme-dark .doc-lock-btn i { color: var(--gold-400); }
.doc-lock-list {
  margin: 10px 0 0;
  padding-left: 1.15rem;
  text-align: left;
  color: var(--text);
}
.doc-lock-list li { margin: 6px 0; }
.doc-lock-list a { color: var(--navy-800); font-weight: 600; }
.doc-lock-list span { color: var(--muted); }
.theme-dark .doc-lock-list a { color: var(--gold-400); }
.theme-dark .doc-lock-list span { color: #c5d0da; }

.layout-col {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  min-height: 48px;
}
.layout-col > .settings-card,
.layout-col > .card-soft {
  margin-bottom: 0 !important;
}
.layout-col > .layout-box,
.layout-col > [data-layout-box],
.layout-col > .settings-card,
.layout-col > .card-soft,
.layout-col > .ticket-status-bar {
  width: 100%;
  max-width: 100%;
}
.layout-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: color-mix(in srgb, var(--navy-800) 8%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.layout-hint p { margin: 0; flex: 1; min-width: 200px; }
.layout-board.is-customizing .layout-col {
  outline: 2px dashed color-mix(in srgb, var(--gold, #c9a227) 55%, var(--border));
  outline-offset: 4px;
  border-radius: 14px;
  min-height: 120px;
  padding: 8px 4px 4px;
  background: color-mix(in srgb, var(--navy-800) 3%, transparent);
}
.layout-board.is-customizing .layout-col.is-drop {
  outline-color: var(--gold-600, #c9a227);
  background: color-mix(in srgb, var(--gold, #c9a227) 12%, transparent);
}
.layout-handle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card, #fff);
  color: var(--navy-800);
  display: none;
  place-items: center;
  cursor: grab;
  padding: 0;
}
.layout-board.is-customizing .layout-handle { display: grid; }
.layout-board.is-customizing .layout-handle:active { cursor: grabbing; }
.layout-board.is-customizing .layout-box,
.layout-board.is-customizing [data-layout-box],
.layout-board.is-customizing .layout-col > .settings-card,
.layout-board.is-customizing .layout-col > .card-soft {
  position: relative;
  user-select: none;
}
.layout-board.is-customizing .layout-box.is-dragging,
.layout-board.is-customizing [data-layout-box].is-dragging {
  opacity: 0.45;
}
.layout-drop-hint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 28px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.layout-box.is-placed,
.layout-board [data-layout-box].is-placed {
  animation: pipe-card-in .18s ease;
}
.license-banner { margin-bottom: 16px; align-items: center; }
.license-banner .btn { flex-shrink: 0; }
.lr-modal[hidden] { display: none !important; }
.lr-modal {
  position: fixed; inset: 0; z-index: 1080;
  display: grid; place-items: center; padding: 16px;
}
.lr-modal-backdrop {
  position: absolute; inset: 0; background: rgba(16, 24, 40, 0.45);
}
.lr-modal-card {
  position: relative; z-index: 1; width: min(520px, 100%);
  background: #fff; border-radius: 16px; box-shadow: 0 24px 64px rgba(16, 24, 40, 0.28);
  overflow: hidden;
}
.theme-dark .lr-modal-card { background: #151c26; }
.lr-modal-head {
  display: flex; gap: 12px; justify-content: space-between; align-items: flex-start;
  padding: 18px 18px 8px;
}
.lr-modal-kicker {
  margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.lr-modal-head h3 { margin: 4px 0 6px; font-size: 1.15rem; }
.lr-modal-sub { margin: 0; color: var(--muted); font-size: 14px; }
.lr-modal-body { padding: 8px 18px 12px; }
.lr-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 8px; }
.lr-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lr-facts dd { margin: 0; font-weight: 600; }
.lr-modal-foot {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 12px 18px 18px; border-top: 1px solid var(--border);
}
body.lr-modal-open { overflow: hidden; }

@media print {
  .layout-hint, .layout-handle { display: none !important; }
  .license-banner, .lr-modal { display: none !important; }
  .page-guide, .page-guide-btn, .page-guide-panel { display: none !important; }
}



/* Couriers / shipments on sales orders */
.shipment-panel h2.h6 { color: var(--navy-800); }
.theme-dark .shipment-panel h2.h6 { color: #fff; }
.shipment-panel .text-muted { color: var(--muted) !important; }
.theme-dark .shipment-panel .text-muted { color: #c5d0da !important; }
.shipment-add-form {
  background: var(--card);
  border-color: var(--border) !important;
}
.theme-dark .shipment-add-form {
  background: var(--card);
  border-color: var(--border) !important;
}
.shipment-note-row td {
  background: rgba(16, 56, 96, 0.04);
  border-top: 0 !important;
}
.theme-dark .shipment-note-row td {
  background: rgba(255, 255, 255, 0.04);
  color: #c5d0da;
}
.theme-dark .shipment-panel code {
  color: var(--gold-400);
  background: rgba(232, 200, 92, 0.12);
}

/* Business profile picker (Settings + installer) */
.business-profile-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.business-profile-option input {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.2rem 0 0;
  accent-color: var(--gold-500);
}
.business-profile-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
}
.business-profile-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
}
.business-profile-option strong {
  display: inline;
  color: var(--navy-800);
  margin: 0;
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
}
.business-profile-current {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(40, 167, 69, 0.15);
  color: #2f8f4e;
  border: 1px solid rgba(40, 167, 69, 0.35);
  white-space: nowrap;
}
.theme-dark .business-profile-current {
  background: rgba(72, 187, 120, 0.18);
  color: #8fd9a8;
  border-color: rgba(72, 187, 120, 0.35);
}
.business-profile-option small {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}
.business-profile-option.is-selected,
.business-profile-option:has(input:checked) {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 1px var(--gold-500);
}
.business-profile-option.is-current {
  background: rgba(232, 200, 92, 0.08);
}
.theme-dark .business-profile-option.is-current {
  background: rgba(232, 200, 92, 0.1);
}
.theme-dark .business-profile-option strong { color: #fff; }
.theme-dark .business-profile-option small { color: #c5d0da; }

.business-profile-locked .business-profile-summary {
  background: var(--card);
  border: 1px solid var(--border);
}
.business-profile-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.business-profile-summary-head strong {
  color: var(--navy-800);
  font-size: 15px;
}
.theme-dark .business-profile-summary-head strong { color: #fff; }
.business-profile-locked .form-text .bi { color: var(--gold-600); margin-right: 4px; }
.theme-dark .business-profile-locked .form-text .bi { color: var(--gold-400); }

/* Dashboard recommended flow — compact strip */
.dash-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 14px 10px 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}
.dash-flow-title {
  margin: 0;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy-800);
  white-space: nowrap;
}
.dash-flow-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 4px 0;
  min-width: 0;
}
.dash-flow-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 10px 2px 0;
  color: var(--text);
  white-space: nowrap;
}
.dash-flow-step:not(.is-last)::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 10px;
  border-top: 1.5px solid var(--gold-500);
  border-right: 1.5px solid var(--gold-500);
  transform: rotate(45deg);
  opacity: 0.75;
  flex-shrink: 0;
}
.dash-flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-400), var(--gold-600));
  color: var(--navy-900);
  font-weight: 800;
  font-size: 10px;
  line-height: 1;
}
.dash-flow-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

@media (max-width: 640px) {
  .dash-flow {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
  }
  .dash-flow-steps {
    width: 100%;
  }
  .dash-flow-step {
    white-space: normal;
  }
}

.theme-dark .dash-flow-title { color: #fff; }
.theme-dark .dash-flow-label { color: #eef3f8; }
.theme-dark .dash-flow-num { color: #0a2744; }
