/* D.I.C. Books — layout shell · DIC brand (red / white / black) */
:root {
  --fb-accent: #e31837;
  --fb-accent-dark: #b8122e;
  --fb-accent-light: #fff0f2;
  --fb-bg: #f4f5f7;
  --fb-white: #ffffff;
  --fb-text: #1b1d21;
  --fb-text-muted: #6e7780;
  --fb-border: #d5d9de;
  --fb-sidebar-w: 220px;
  --fb-col-w: 1075px;
  --fb-green-paid: #0d8050;
  --fb-blue-sent: #2563eb;
  --fb-purple-viewed: #7c3aed;
  --fb-orange-draft: #9ca3af;
  --fb-red-overdue: #dc2626;
  --fb-font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--fb-font);
  font-size: 14px;
  color: var(--fb-text);
  background: var(--fb-bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ========== LOGIN (DIC-style) ========== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fb-white);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

/* The vector logo has no built-in margin, unlike the raster it replaced, so
   every box below is sized to the mark itself rather than to empty space. */
.login-logo { display: block; max-width: 210px; width: 100%; height: auto; margin: 0 auto 32px; }

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fb-text);
}

.login-card .subtitle {
  color: var(--fb-text-muted);
  margin-bottom: 28px;
  font-size: .9rem;
}

.login-body { text-align: left; }

.login-body label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--fb-text);
}

.login-body input, .login-body select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  font-size: .95rem;
  margin-bottom: 16px;
}

.login-body input:focus, .login-body select:focus {
  outline: none;
  border-color: var(--fb-accent);
  box-shadow: 0 0 0 3px rgba(227,24,55,.12);
}

.btn-login {
  width: 100%;
  padding: 12px 16px;
  background: var(--fb-accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-family: var(--fb-font);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
}

.btn-login:hover { background: var(--fb-accent-dark); }

.login-error {
  background: #fef2f2;
  color: var(--fb-red-overdue);
  padding: 10px;
  border-radius: 4px;
  font-size: .85rem;
  margin-bottom: 12px;
  display: none;
}

.demo-hint {
  margin-top: 20px;
  padding: 12px;
  background: var(--fb-bg);
  border-radius: 4px;
  font-size: .78rem;
  color: var(--fb-text-muted);
  line-height: 1.5;
}

.demo-disclosure {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border-left: 3px solid var(--fb-accent);
  background: var(--fb-accent-light);
  color: var(--fb-text);
  font-size: .75rem;
  line-height: 1.48;
}

.demo-disclosure strong { font-size: .8rem; }

/* ========== APP SHELL ========== */
.app-container { display: none; min-height: 100vh; }
.app-container.active { display: flex; }

.fb-sidebar {
  width: var(--fb-sidebar-w);
  background: var(--fb-accent);
  color: #fff;
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 100;
  min-width: 0;
}

.fb-sidebar-account {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}

.fb-sidebar-account-name {
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-sidebar-account-role {
  margin-top: 4px;
  font-size: .78rem;
  opacity: .9;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}

.fb-sidebar-account-role i { font-size: .65rem; opacity: .85; }

.fb-nav {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 10px 0 8px;
  overflow-x: hidden;
  overflow-y: auto;
}

.fb-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 16px;
  color: rgba(255,255,255,.92);
  cursor: pointer;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: background .15s;
  position: relative;
}

.fb-nav-item:hover { background: rgba(0,0,0,.12); color: #fff; }

.fb-nav-item.active {
  background: rgba(0,0,0,.22);
  border-left-color: #fff;
  color: #fff;
  font-weight: 600;
}

.fb-nav-item i { width: 18px; text-align: center; font-size: .85rem; color: rgba(255,255,255,.85); }
.fb-nav-item.active i { color: #fff; }
.fb-nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(255,255,255,.92);
  display: block;
}
.fb-nav-item.active .fb-nav-ico { color: #fff; }
.fb-nav-chevron { margin-left: auto; width: auto !important; font-size: .65rem !important; opacity: .75; }
/* Lower Apps section: text-only links matching FreshBooks */
.fb-nav-item-sm {
  font-size: .8125rem;
  padding: 6px 16px 6px 20px;
  font-weight: 400;
  gap: 0;
  opacity: .95;
}
.fb-nav-item-sm .fb-nav-ico,
.fb-nav-item-sm > i:not(.fb-nav-chevron) { display: none; }

.fb-nav-badge {
  margin-left: auto;
  background: #fff;
  color: var(--fb-accent);
  border: 1px solid #fff;
  font-size: .55rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.fb-page-intro {
  color: var(--fb-text-muted);
  margin-bottom: 20px;
  font-size: .9rem;
  line-height: 1.5;
}

.fb-apps-list { display: flex; flex-direction: column; gap: 12px; }
.fb-app-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fb-app-row p { font-size: .85rem; color: var(--fb-text-muted); margin-top: 4px; }

/* Additional Tools — DIC custom integrations */
.fb-tools-hero {
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-left: 4px solid var(--fb-accent);
  border-radius: 4px;
  padding: 24px 28px;
  margin-bottom: 24px;
}

.fb-tools-hero h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--fb-text);
}

.fb-tools-hero p {
  font-size: .9rem;
  color: var(--fb-text-muted);
  line-height: 1.65;
  max-width: 900px;
}

.fb-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 1100px) { .fb-tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .fb-tools-grid { grid-template-columns: 1fr; } }

.fb-tool-card {
  background: var(--fb-white);
  border: 2px dashed var(--fb-border);
  border-radius: 4px;
  padding: 28px 20px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}

.fb-tool-card:hover {
  border-color: var(--fb-accent);
  box-shadow: 0 2px 12px rgba(227, 24, 55, .08);
}

.fb-tool-icon { font-size: 2rem; margin-bottom: 14px; line-height: 1; }

.fb-tool-card h4 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--fb-text);
}

.fb-tool-card p {
  font-size: .82rem;
  color: var(--fb-text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
  min-height: 64px;
}

.fb-coming-soon {
  display: inline-block;
  background: var(--fb-accent);
  color: #fff;
  padding: 7px 18px;
  border-radius: 3px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  border: none;
  cursor: default;
}

.fb-nav-divider {
  height: 1px;
  background: rgba(255,255,255,.2);
  margin: 10px 16px;
}

.fb-nav-label {
  font-size: .7rem;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255,255,255,.72);
  padding: 10px 16px 2px 20px;
  font-weight: 400;
}

.fb-sidebar-footer {
  padding: 14px 12px 18px;
  border-top: none;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  flex-shrink: 0;
}

.fb-sidebar-logo {
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  max-height: 72px;
  height: auto;
  object-fit: contain;
  padding: 8px 10px;
  background: #fff;
  border-radius: 6px;
  margin: 0 auto;
}

.fb-sidebar-user { display: none; }

.btn-logout {
  margin-top: 12px;
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 3px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--fb-font);
  color: #fff;
}

.btn-logout:hover { background: rgba(0,0,0,.18); }

/* ========== WORKSPACE ========== */
.fb-workspace {
  margin-left: var(--fb-sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.fb-topbar {
  background: var(--fb-white);
  border-bottom: 1px solid var(--fb-border);
  padding: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.fb-topbar-spacer { display: none; }

.fb-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--fb-border);
  border-radius: 8px;
  background: #fff;
  color: var(--fb-text);
  cursor: pointer;
  flex-shrink: 0;
}
.fb-nav-toggle:hover { border-color: var(--fb-accent); color: var(--fb-accent); }
.fb-nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}

.fb-topbar-actions {
  width: 100%;
  max-width: var(--fb-col-w);
  justify-content: flex-end;
}

.fb-business-name {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
}

.fb-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.fb-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--fb-border);
  border-radius: 20px;
  font-size: .875rem;
  background: var(--fb-bg);
}

.fb-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fb-text-muted);
  font-size: .8rem;
}

.fb-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fb-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--fb-text-muted);
  font-size: 1rem;
}

.fb-icon-btn:hover { background: var(--fb-bg); }

.fb-avatar-wrap { position: relative; }

.fb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--fb-border);
  color: var(--fb-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.fb-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}

.fb-avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 300;
  padding: 8px 0;
}

.fb-avatar-menu[hidden] { display: none !important; }

.fb-avatar-menu-meta {
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--fb-border);
}

.fb-avatar-menu-meta .user-name { font-weight: 600; font-size: .875rem; color: var(--fb-text); }
.fb-avatar-menu-meta .user-meta { color: var(--fb-text-muted); font-size: .75rem; margin-top: 2px; }

.fb-avatar-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 14px;
  font-family: var(--fb-font);
  font-size: .875rem;
  color: var(--fb-text);
  cursor: pointer;
}

.fb-avatar-menu-item:hover { background: var(--fb-bg); color: var(--fb-accent); }

/* FreshBooks centers page content in a fixed column; topbar actions align to it */
.fb-content {
  flex: 1;
  width: 100%;
  max-width: var(--fb-col-w);
  margin: 0 auto;
  padding: 24px 0 48px;
}

@media (max-width: 1400px) {
  .fb-content,
  .fb-topbar-actions { padding-left: 20px; padding-right: 20px; }
}

/* ========== PAGE HEADER (DIC style) ========== */
.fb-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
}

.fb-page-head h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--fb-text);
}

.fb-page-head-3col {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.fb-page-head-3col > h1 { justify-self: start; margin: 0; }
.fb-page-head-3col .fb-page-head-center {
  position: static;
  left: auto;
  transform: none;
  justify-self: center;
}
.fb-page-head-3col .fb-page-actions { justify-self: end; }

.fb-page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ========== BUTTONS (DIC shape · DIC red / white / black) ========== */
.fb-btn {
  padding: 11px 22px;
  border-radius: 4px;
  font-family: var(--fb-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.25;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.fb-btn-primary {
  background: var(--fb-accent);
  color: #fff;
  border-color: var(--fb-accent);
}
.fb-btn-primary:hover { background: var(--fb-accent-dark); border-color: var(--fb-accent-dark); color: #fff; }

.fb-btn-secondary {
  background: var(--fb-white);
  color: var(--fb-text);
  border-color: #c5ccd3;
}
.fb-btn-secondary:hover { background: #f7f8f9; border-color: #aeb6bf; color: #000; }

.fb-btn-ghost {
  background: transparent;
  color: var(--fb-accent);
  border: none;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}
.fb-btn-ghost:hover { color: var(--fb-accent-dark); }

.fb-btn-link {
  background: none;
  border: none;
  color: var(--fb-accent);
  cursor: pointer;
  font-family: var(--fb-font);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
.fb-btn-link:hover { color: var(--fb-accent-dark); text-decoration: underline; }

/* FreshBooks "More Actions" is a borderless dark-text control */
.fb-btn-more { color: var(--fb-text); padding: 8px 12px; }
.fb-btn-more:hover { color: var(--fb-accent); text-decoration: none; }
.fb-btn-more i { color: var(--fb-text-muted); }

/* Create New dropdown */
.fb-dropdown { position: relative; display: inline-block; }

.fb-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  min-width: 220px;
  z-index: 200;
  padding: 6px 0;
}

.fb-dropdown.open .fb-dropdown-menu { display: block; }

.fb-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-size: .875rem;
}

.fb-dropdown-item:hover { background: var(--fb-bg); }

/* ========== SUB NAV TABS (Invoices, Payments, etc.) ========== */
/* FreshBooks tab strip: active tab is a bordered white box sitting on the rule */
.fb-subnav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--fb-border);
  margin-bottom: 18px;
}

.fb-subnav-tab {
  padding: 9px 18px;
  font-size: 14px;
  color: var(--fb-accent);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
  margin-bottom: -1px;
  background: transparent;
}

.fb-subnav-tab:hover { color: var(--fb-accent-dark); }

.fb-subnav-tab.active {
  color: var(--fb-text);
  background: var(--fb-white);
  border-color: var(--fb-border);
  border-bottom-color: var(--fb-white);
  font-weight: 600;
}

/* ========== CARDS & WIDGETS ========== */
.fb-card {
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.fb-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.fb-card-sub {
  font-size: .75rem;
  color: var(--fb-text-muted);
  margin-bottom: 16px;
}

.fb-dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fb-dashboard-grid > .fb-card,
.fb-dashboard-grid > .dash-widget {
  margin-bottom: 0;
}

.fb-widget-total {
  font-size: 2rem;
  font-weight: 300;
  color: var(--fb-text);
  margin: 8px 0 16px;
}

.fb-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-top: 8px;
}

.fb-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
}

.fb-bar.overdue { background: var(--fb-red-overdue); }
.fb-bar.outstanding { background: var(--fb-accent); opacity: .7; }

.fb-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.fb-donut {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--fb-accent) 0% 45%, #3b82f6 45% 70%, #f59e0b 70% 100%);
  position: relative;
}

.fb-donut::after {
  content: '';
  position: absolute;
  inset: 22px;
  background: var(--fb-white);
  border-radius: 50%;
}

.fb-legend { font-size: .8rem; }
.fb-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fb-legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ========== ADVANCED SEARCH (DIC) ========== */
.fb-advanced-search {
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
}

/* Opened by the Advanced Search button, and kept open while a filter is set. */
.fb-advanced-search.is-open { display: block; }

.fb-search-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.fb-field label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--fb-text-muted);
}

.fb-field input, .fb-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  font-size: .875rem;
}

/* ========== DATA TABLE (DIC list) ========== */
.fb-table-wrap {
  background: var(--fb-white);
  border: none;
  border-radius: 0;
  overflow: visible;
}

.fb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.fb-table th {
  text-align: left;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--fb-border);
  font-weight: 600;
  font-size: 13px;
  color: var(--fb-text);
  text-transform: none;
  letter-spacing: 0;
}

.fb-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e9ebee;
  vertical-align: middle;
}

.fb-table td small { color: var(--fb-text-muted); font-size: 12px; }
.fb-table tr:last-child td { border-bottom: 1px solid #e9ebee; }

.fb-table tr:hover td { background: #fafbfc; }

.fb-table tr:last-child td { border-bottom: none; }

.fb-row-clickable { cursor: pointer; }
.fb-row-clickable:hover td { background: #f3f4f6 !important; }

.fb-client-overview { display: flex; flex-direction: column; gap: 16px; }
.fb-client-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) {
  .fb-client-stats { grid-template-columns: repeat(2, 1fr); }
}
.fb-client-info-card {
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  padding: 20px 24px;
}
.fb-client-info-card h3 {
  margin: 0 0 16px;
  font-size: 1rem;
}
.fb-client-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 24px;
}
@media (max-width: 900px) {
  .fb-client-detail-grid { grid-template-columns: repeat(2, 1fr); }
}
.fb-client-detail-grid label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--fb-text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}

/* Status pills — DIC exact colors */
.fb-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.fb-status-draft { background: #f3f4f6; color: #6b7280; }
.fb-status-sent { background: #dbeafe; color: #1d4ed8; }
.fb-status-viewed { background: #ede9fe; color: #6d28d9; }
.fb-status-paid { background: #d1fae5; color: #047857; }
.fb-status-overdue { background: #fee2e2; color: #b91c1c; }
.fb-status-pending { background: #fef3c7; color: #b45309; }
.fb-status-active { background: #d1fae5; color: #047857; }

/* ========== EXPENSE RECEIPT DROP (DIC paper look) ========== */
.fb-receipt-board {
  background: linear-gradient(135deg, #f5e6c8 0%, #edd9a3 100%);
  border: 1px solid #d4bc82;
  border-radius: 4px;
  padding: 32px;
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.06);
}

.fb-receipt-board::before {
  content: '📌';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
}

.fb-receipt-board p { color: #5c4a2a; font-size: .9rem; margin-top: 16px; }

/* ========== MODAL ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--fb-white);
  border-radius: 4px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
}

.modal.modal-lg { max-width: 820px; }
.modal.modal-xl { max-width: 960px; }

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--fb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 { font-size: 1.15rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--fb-text-muted);
  line-height: 1;
}

.modal-body {
  padding: 24px 28px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-footer {
  padding: 16px 28px 20px;
  border-top: 1px solid var(--fb-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  background: #fafbfc;
  flex-shrink: 0;
}

/* DIC modal form fields */
.modal .form-row { margin-bottom: 18px; }
.modal .form-row label {
  display: block;
  font-size: .8125rem;
  font-weight: 400;
  color: var(--fb-text);
  margin-bottom: 6px;
}
.modal .form-row input,
.modal .form-row select,
.modal .form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c5cdd5;
  border-radius: 3px;
  font-size: .9375rem;
  color: var(--fb-text);
  background: #fff;
  font-family: inherit;
}
.modal .form-row input:focus,
.modal .form-row select:focus,
.modal .form-row textarea:focus {
  outline: none;
  border-color: var(--fb-accent);
  box-shadow: 0 0 0 3px rgba(227, 24, 55, 0.15);
}
.modal .form-row textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.modal .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.fb-field-with-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.fb-field-with-action > input,
.fb-field-with-action > select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}
.fb-field-action-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: stretch;
  padding: 10px 14px;
  font-size: .875rem;
}
.fb-field-hint {
  display: block;
  margin-top: 6px;
  color: #6e7780;
  font-size: .75rem;
  line-height: 1.4;
}
.modal .form-row-check { margin-bottom: 18px; }
.modal .fb-check-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-bottom: 0 !important;
  font-size: .9375rem !important;
  cursor: pointer;
  line-height: 1.3;
}
.modal .fb-check-label input[type="checkbox"] {
  width: 16px !important;
  height: 16px;
  padding: 0 !important;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--fb-accent);
}

@media (max-width: 520px) {
  .fb-field-with-action { flex-direction: column; }
  .fb-field-action-btn { width: 100%; }
  .modal .form-row-2 { grid-template-columns: 1fr; }
}

.fb-modal-preview {
  background: #f9fafb;
  border: 1px solid var(--fb-border);
  border-radius: 3px;
  padding: 16px 18px;
  margin-top: 8px;
}
.fb-modal-preview strong { display: block; font-size: .9375rem; margin-bottom: 6px; }
.fb-modal-preview p { font-size: .8125rem; color: var(--fb-text-muted); line-height: 1.5; margin: 0; }

/* DIC modal buttons — Cancel link + outlined primary */
.modal-footer .fb-btn-modal-cancel {
  background: transparent;
  border: none;
  color: var(--fb-text);
  font-size: .9375rem;
  font-weight: 400;
  cursor: pointer;
  padding: 10px 16px;
  font-family: inherit;
}
.modal-footer .fb-btn-modal-cancel:hover { text-decoration: underline; }

.modal-footer .fb-btn-modal-save {
  background: #fff;
  border: 1px solid #333;
  color: #333;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 3px;
  font-family: inherit;
}
.modal-footer .fb-btn-modal-save:hover { background: #f9fafb; }

.modal-footer .fb-btn-modal-primary {
  background: var(--fb-accent);
  border: 1px solid var(--fb-accent);
  color: #fff;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 3px;
  font-family: inherit;
}
.modal-footer .fb-btn-modal-primary:hover { background: var(--fb-accent-dark); }

/* Expense receipt drop — DIC cork-board style */
.fb-receipt-drop {
  border: 2px dashed #b8c4ce;
  border-radius: 3px;
  padding: 36px 20px;
  text-align: center;
  background: #fafafa;
  color: #6b7280;
  font-size: .875rem;
  cursor: pointer;
}
.fb-receipt-drop i { display: block; font-size: 1.25rem; margin-bottom: 8px; color: #9ca3af; }
.fb-receipt-drop small { display: block; margin-top: 6px; font-size: .75rem; color: #9ca3af; }

.fb-expense-modal-strip {
  height: 8px;
  background: linear-gradient(180deg, #d4bc82 0%, #c4a86e 100%);
  margin: -24px -28px 20px;
  border-radius: 0;
}

/* DIC invoice editor — form + preview */
.fb-invoice-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) { .fb-invoice-editor { grid-template-columns: 1fr; } }

.fb-invoice-paper {
  background: #fffef8;
  border: 1px solid #e8e4d4;
  box-shadow: 2px 3px 8px rgba(0,0,0,.08);
  padding: 24px;
  position: relative;
}

.fb-invoice-paper::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: var(--fb-accent);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--fb-border); border-radius: 4px; font-size: .875rem;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.mock-line-items { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 12px 0; }
.mock-line-items th, .mock-line-items td { padding: 8px; border-bottom: 1px solid #eee; text-align: left; }
.mock-line-items th { background: #f9fafb; font-size: .7rem; text-transform: uppercase; }

.mock-steps { display: flex; gap: 6px; margin-bottom: 20px; }
.mock-step { flex: 1; text-align: center; padding: 8px; border-radius: 4px; background: #f3f4f6; font-size: .72rem; font-weight: 600; color: var(--fb-text-muted); }
.mock-step.active { background: var(--fb-accent); color: #fff; }
.mock-step.done { background: #d1fae5; color: #047857; }

.mock-progress { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; margin: 12px 0; }
.mock-progress-bar { height: 100%; background: var(--fb-accent); transition: width .4s; }

.mock-success { text-align: center; padding: 20px; }
.mock-success .success-icon { font-size: 2.5rem; color: var(--fb-green-paid); margin-bottom: 12px; }

.mock-hint-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 12px;
  font-size: .82rem;
  margin-bottom: 16px;
  color: #1e40af;
}

.mock-payroll-table { width: 100%; font-size: .82rem; border-collapse: collapse; }
.mock-payroll-table th, .mock-payroll-table td { padding: 8px; border-bottom: 1px solid #f0f0f0; text-align: left; }
.mock-payroll-table th { background: #f9fafb; }

.fb-reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.fb-report-tile {
  background: var(--fb-white);
  border: 1px solid var(--fb-border);
  border-radius: 4px;
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: box-shadow .15s;
}

.fb-report-tile:hover { box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.fb-report-tile .icon { font-size: 1.5rem; margin-bottom: 8px; }
.fb-report-tile h4 { font-size: .85rem; font-weight: 600; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fb-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 4px;
  z-index: 400;
  font-size: .875rem;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-left: 4px solid var(--fb-green-paid); }
.toast.error { border-left: 4px solid #dc2626; background: #fef2f2; }

.hidden { display: none !important; }


/* ========== LOGIN MODE TABS ========== */
.login-mode-tabs {
  display: flex;
  gap: 0;
  margin: 0 auto 20px;
  border: 1px solid var(--fb-border);
  border-radius: 6px;
  overflow: hidden;
  max-width: 320px;
}
.login-mode-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  color: var(--fb-text-muted);
}
.login-mode-tab.active {
  background: var(--fb-accent);
  color: #fff;
}

/* ========== CLIENT PORTAL ========== */
.portal-container {
  display: none;
  min-height: 100vh;
  background: var(--fb-bg);
}
.portal-container.active { display: block; }
.cp-shell { min-height: 100vh; }
.cp-header {
  background: #fff;
  border-bottom: 1px solid var(--fb-border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cp-header-left { display: flex; align-items: center; gap: 12px; }
.cp-logo { height: 40px; width: auto; }
.cp-header-right { display: flex; align-items: center; font-weight: 600; }
.cp-layout { display: flex; min-height: calc(100vh - 70px); }
.cp-nav {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--fb-border);
  padding: 12px 0;
  flex-shrink: 0;
}
.cp-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: .875rem;
  color: var(--fb-text);
}
.cp-nav-item:hover { background: #f3f4f6; }
.cp-nav-item.active {
  background: var(--fb-accent-light);
  color: var(--fb-accent);
  font-weight: 600;
  border-right: 3px solid var(--fb-accent);
}
.cp-nav-item i { width: 18px; text-align: center; color: var(--fb-text-muted); }
.cp-nav-item.active i { color: var(--fb-accent); }
.cp-main { flex: 1; padding: 24px; overflow: auto; }
.cp-title { font-size: 1.5rem; margin-bottom: 16px; }
.cp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.cp-stat { background: #fff; border: 1px solid var(--fb-border); border-radius: 6px; padding: 16px; }
.cp-stat-label { font-size: .75rem; color: var(--fb-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.cp-stat-val { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.cp-comment { background: #f9fafb; border-radius: 6px; padding: 10px 12px; margin-top: 8px; }
.cp-comment p { margin-top: 4px; }
.cp-branding { margin-top: 32px; text-align: center; font-size: .75rem; color: #9ca3af; }

.cp-expand-list { display: flex; flex-direction: column; gap: 12px; }
.cp-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--fb-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.cp-banner p { margin: 4px 0 0; font-size: .875rem; color: #6b7280; }
.cp-expand-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cp-expand-item:hover { border-color: #cfd5de; }
.cp-expand-item.open,
.cp-expand-item.is-open {
  border-color: #e31837;
  box-shadow: 0 4px 16px rgba(227, 24, 55, .08);
}
.cp-expand-item.is-signed { border-color: #86efac; }
.cp-expand-item.is-signed.open {
  border-color: #0d8050;
  box-shadow: 0 4px 16px rgba(13, 128, 80, .1);
}
.cp-expand-item.needs-sign { border-left: 4px solid #e31837; }
.cp-expand-row {
  display: flex;
  align-items: stretch;
  min-height: 72px;
}
.cp-expand-toggle {
  flex: 1;
  display: grid;
  grid-template-columns: 36px minmax(0, 1.5fr) auto auto auto;
  gap: 10px 14px;
  align-items: center;
  padding: 16px 12px 16px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  min-width: 0;
}
.cp-expand-toggle:hover { background: #fafbfc; }
.cp-expand-chevron {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f3f4f6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-size: .75rem;
}
.cp-expand-item.open .cp-expand-chevron {
  background: #fee2e2;
  color: #e31837;
}
.cp-expand-main { min-width: 0; }
.cp-expand-main strong { display: block; font-size: .95rem; }
.cp-expand-main small {
  display: block;
  color: #6b7280;
  font-size: .8rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-expand-meta { font-size: .8rem; color: #6b7280; }
.cp-expand-amt {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}
.cp-expand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-left: 1px solid #eef0f3;
  background: #fafbfc;
  flex-shrink: 0;
}
.cp-btn {
  padding: 8px 12px !important;
  font-size: .8rem !important;
  white-space: nowrap;
  border-radius: 6px !important;
}
.cp-expand-body {
  padding: 4px 16px 18px;
  border-top: 1px solid #eef0f3;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}
.cp-doc-footer-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cp-doc-paper {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 22px;
  margin-top: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.cp-doc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.cp-doc-logo { height: 72px; width: auto; }
.cp-doc-biz {
  text-align: right;
  font-size: .8rem;
  line-height: 1.45;
  color: #4b5563;
}
.cp-doc-biz-name { font-weight: 700; color: #0c192a; }
.cp-doc-meta { text-align: right; font-size: .8rem; color: #6b7280; }
.cp-doc-title { font-size: 1.35rem; margin: 0 0 8px; }
.cp-doc-from { font-size: .875rem; color: #6b7280; margin-bottom: 12px; line-height: 1.45; }
.cp-doc-summary { font-size: .9rem; line-height: 1.55; color: #374151; margin-bottom: 12px; }
.cp-doc-amount {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 12px 0;
  color: #111827;
}
.cp-await { color: #b45309; font-size: .875rem; margin-top: 12px; }
.cp-linked { margin-top: 12px; font-size: .875rem; color: #0d8050; }
.cp-sig-block {
  margin-top: 18px;
  padding: 14px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}
.cp-sig-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #6b7280; }
.cp-sig-meta { font-size: .85rem; color: #374151; margin: 6px 0 8px; }
.cp-line-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.cp-line-table th, .cp-line-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 4px;
  text-align: left;
  font-size: .875rem;
}
.cp-line-table td:last-child, .cp-line-table th:last-child { text-align: right; }
.cp-doc-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cp-signed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.cp-section-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  margin-bottom: 6px;
}
.cp-success-banner { border-left: 4px solid #0d8050; }
.cp-recent-signed {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.cp-recent-signed:hover { background: #f9fafb; border-color: #e31837; }
.cp-recent-signed span { color: #6b7280; font-size: .8rem; }
.cp-recent-signed i { color: #9ca3af; }
@media (max-width: 900px) {
  .cp-signed-grid { grid-template-columns: 1fr; }
  .cp-expand-row { flex-direction: column; }
  .cp-expand-actions {
    border-left: 0;
    border-top: 1px solid #eef0f3;
    justify-content: flex-end;
  }
  .cp-expand-toggle {
    grid-template-columns: 28px 1fr;
  }
}
@media (max-width: 768px) {
  .cp-layout { flex-direction: column; }
  .cp-nav { width: 100%; display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--fb-border); }
  .cp-nav-item { white-space: nowrap; border-right: none !important; }
}

/* ========== E-SIGN (DIC-style) ========== */
.modal.modal-xl { max-width: 980px; width: calc(100% - 32px); }
.esign-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 820px) {
  .esign-layout { grid-template-columns: 1fr; }
}
.esign-paper {
  background: #fffef9;
  border: 1px solid #e5e1d4;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  padding: 28px 24px;
  border-radius: 2px;
  position: relative;
}
.esign-paper-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.esign-logo { height: 44px; width: auto; }
.esign-paper-meta { text-align: right; font-size: .8rem; color: #6b7280; }
.esign-badge {
  display: inline-block;
  background: var(--fb-accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 3px;
  margin-bottom: 6px;
}
.esign-doc-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #1f2937;
}
.esign-doc-from { font-size: .875rem; color: #6b7280; margin-bottom: 12px; }
.esign-doc-summary { font-size: .9rem; line-height: 1.5; color: #374151; margin-bottom: 16px; }
.esign-doc-amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 20px;
}
.esign-terms {
  border-top: 1px solid #ece7da;
  padding-top: 14px;
  font-size: .82rem;
  color: #4b5563;
  line-height: 1.5;
}
.esign-terms strong { display: block; margin-bottom: 4px; color: #111827; }
.esign-req-line {
  margin-top: 18px;
  padding: 10px 12px;
  background: #fff0f2;
  border: 1px dashed #f5a3b0;
  color: var(--fb-accent);
  font-size: .82rem;
  font-weight: 600;
  border-radius: 4px;
}
.esign-sign-panel h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.esign-sign-intro {
  font-size: .875rem;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.45;
}
.esign-tabs {
  display: flex;
  border: 1px solid var(--fb-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.esign-tab {
  flex: 1;
  border: none;
  background: #fff;
  padding: 10px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  color: #6b7280;
}
.esign-tab.active {
  background: var(--fb-accent);
  color: #fff;
}
.esign-pad-wrap {
  position: relative;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  background:
    linear-gradient(to top, transparent 27px, #e5e7eb 28px, transparent 29px),
    #fafafa;
  background-size: 100% 100%;
  touch-action: none;
  overflow: hidden;
}
#esign-canvas {
  display: block;
  width: 100%;
  height: 180px;
  cursor: crosshair;
  touch-action: none;
}
.esign-pad-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #9ca3af;
  font-size: .95rem;
  font-style: italic;
}
.esign-pad-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.esign-pad-note { font-size: .75rem; color: #9ca3af; }
.esign-typed-input {
  width: 100%;
  padding: 28px 16px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  background: #fafafa;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  font-style: italic;
}
.esign-agree {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: .8rem;
  color: #374151;
  line-height: 1.4;
}
.esign-agree input { margin-top: 3px; }
.esign-captured {
  margin-top: 12px;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.esign-captured img {
  max-width: 100%;
  height: auto;
  max-height: 120px;
  display: block;
}

.client-sig-under-name {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.client-sig-under-name img {
  max-height: 48px;
  max-width: 180px;
  height: auto;
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 4px 8px;
}
.client-sig-under-name.compact img {
  max-height: 36px;
  max-width: 120px;
}
.client-sig-caption {
  font-size: .75rem;
  color: #6b7280;
}


/* Mobile app demo */
.mobile-demo-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.mobile-phone {
  width: 280px; background: #111; border-radius: 36px; padding: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.25); border: 3px solid #333;
}
.mobile-notch { width: 100px; height: 8px; background: #222; border-radius: 0 0 10px 10px; margin: 0 auto 8px; }
.mobile-screen { background: #f8fafc; border-radius: 28px; padding: 16px; min-height: 420px; }
.mobile-status { font-size: .7rem; color: #6b7280; text-align: center; }
.mobile-action {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 12px; margin-top: 8px; border: 1px solid #e5e7eb;
  border-radius: 12px; background: #fff; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.mobile-action:hover { border-color: var(--fb-accent); background: #fff0f2; }
.mobile-action i { color: var(--fb-accent); width: 20px; text-align: center; }

/* Staff document preview (read-only — no staff e-sign) */
.staff-doc-paper {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 28px 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.staff-doc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 8px;
}
/* The tagline in the mark needs about this much height to stay readable. */
.staff-doc-logo { height: 72px; width: auto; }
.staff-doc-meta { text-align: right; font-size: .8rem; color: #6b7280; }
.staff-doc-title { font-size: 1.35rem; margin: 0 0 8px; }
.staff-doc-from { font-size: .875rem; color: #6b7280; margin-bottom: 12px; }
.staff-doc-summary { font-size: .9rem; line-height: 1.55; color: #374151; margin-bottom: 12px; }
.staff-doc-amount { font-size: 1.65rem; font-weight: 700; margin: 0; color: #0c192a; }
.staff-doc-linked { margin-top: 12px; font-size: .875rem; color: #0d8050; }
.staff-doc-pending { margin-top: 16px; border-left: 4px solid #f59e0b; }
.staff-doc-sig { margin-top: 16px; border-left: 4px solid #0d8050; }
.staff-doc-biz {
  text-align: right;
  font-size: .8125rem;
  color: #374151;
  line-height: 1.45;
}
.staff-doc-biz-name { font-weight: 700; color: #0c192a; }
.staff-doc-meta-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  gap: 16px;
  margin: 20px 0 18px;
  font-size: .875rem;
}
.staff-doc-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6e7780;
  margin-bottom: 4px;
}
.staff-doc-due-box { text-align: right; }
.staff-doc-lines {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: .875rem;
}
.staff-doc-lines th {
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6e7780;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 6px;
}
.staff-doc-lines td {
  border-bottom: 1px solid #f3f4f6;
  padding: 10px 6px;
  vertical-align: top;
}
.staff-doc-num { text-align: right; white-space: nowrap; }
.staff-doc-totals {
  margin-left: auto;
  width: min(280px, 100%);
  font-size: .875rem;
}
.staff-doc-total-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}
.staff-doc-total-row.is-due {
  border-top: 2px solid #0c192a;
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 1rem;
}
.staff-doc-notes { margin-top: 18px; }
.staff-doc-notes h4 {
  margin: 0 0 4px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6e7780;
}
.staff-doc-notes p { margin: 0; font-size: .875rem; color: #374151; line-height: 1.5; }

/* Brand theme + font on document paper / brand preview */
.staff-doc-paper,
.dic-inv-preview,
.dic-empty-doc,
.ninv-paper {
  --doc-accent: #e31837;
  --doc-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.staff-doc-paper[data-brand-theme="purple"], .dic-inv-preview[data-brand-theme="purple"], .dic-empty-doc[data-brand-theme="purple"], .ninv-paper[data-brand-theme="purple"] { --doc-accent: #7c3aed; }
.staff-doc-paper[data-brand-theme="red"], .dic-inv-preview[data-brand-theme="red"], .dic-empty-doc[data-brand-theme="red"], .ninv-paper[data-brand-theme="red"] { --doc-accent: #e31837; }
.staff-doc-paper[data-brand-theme="blue"], .dic-inv-preview[data-brand-theme="blue"], .dic-empty-doc[data-brand-theme="blue"], .ninv-paper[data-brand-theme="blue"] { --doc-accent: #2563eb; }
.staff-doc-paper[data-brand-theme="green"], .dic-inv-preview[data-brand-theme="green"], .dic-empty-doc[data-brand-theme="green"], .ninv-paper[data-brand-theme="green"] { --doc-accent: #16a34a; }
.staff-doc-paper[data-brand-theme="grey"], .dic-inv-preview[data-brand-theme="grey"], .dic-empty-doc[data-brand-theme="grey"], .ninv-paper[data-brand-theme="grey"] { --doc-accent: #6b7280; }
.staff-doc-paper[data-brand-theme="black"], .dic-inv-preview[data-brand-theme="black"], .dic-empty-doc[data-brand-theme="black"], .ninv-paper[data-brand-theme="black"] { --doc-accent: #111827; }
.staff-doc-paper[data-brand-font="Classic"], .dic-inv-preview[data-brand-font="Classic"], .dic-empty-doc[data-brand-font="Classic"], .ninv-paper[data-brand-font="Classic"] {
  --doc-font: Georgia, "Times New Roman", serif;
}
.staff-doc-paper[data-brand-font="Clean"], .dic-inv-preview[data-brand-font="Clean"], .dic-empty-doc[data-brand-font="Clean"], .ninv-paper[data-brand-font="Clean"] {
  --doc-font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.staff-doc-paper[data-brand-font],
.dic-inv-preview[data-brand-font],
.dic-empty-doc[data-brand-font],
.ninv-paper[data-brand-font] {
  font-family: var(--doc-font);
}
.staff-doc-paper .staff-doc-amount,
.staff-doc-paper .staff-doc-biz-name,
.staff-doc-paper .staff-doc-total-row.is-due,
.dic-inv-preview .dic-brand-accent-text,
.ninv-paper .ninv-total-row.is-due {
  color: var(--doc-accent);
}
.staff-doc-paper .staff-doc-lines th {
  border-bottom-color: color-mix(in srgb, var(--doc-accent) 35%, #e5e7eb);
}

@media (max-width: 720px) {
  .staff-doc-meta-row { grid-template-columns: 1fr 1fr; }
  .staff-doc-top { flex-direction: column; }
  .staff-doc-biz { text-align: left; }
}

.login-meta{margin-top:18px;padding:10px 12px;background:#f8fafc;border:1px solid #e5e7eb;border-radius:6px;font-size:.78rem;color:#6b7280;line-height:1.45;text-align:center}

/* —— Live Dashboard Editor —— */
.dash-root { position: relative; }
.dash-editing .dash-widget { outline: 1px dashed transparent; transition: outline-color .15s; }
.dash-editing .dash-widget:hover { outline-color: #94a3b8; }
.dash-widget-selected { outline: 2px solid var(--fb-accent, #e31837) !important; }
.dash-widget-chrome {
  display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px;
}
.dash-mini-btn {
  border: 1px solid #d1d5db; background: #fff; border-radius: 4px;
  font-size: .7rem; padding: 2px 8px; cursor: pointer; color: #374151;
}
.dash-mini-btn:hover { background: #f3f4f6; }
.dash-edit-toolbar {
  background: #111827; color: #f9fafb; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  overflow: visible;
  position: relative;
  z-index: 30;
}
.dash-edit-toolbar-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px;
  overflow: visible;
}
.dash-edit-controls { overflow: visible; position: relative; z-index: 31; }
.dash-edit-toolbar-row:last-child { margin-bottom: 0; }
.dash-edit-toolbar .fb-btn { font-size: .8rem; }
.dash-edit-pill {
  background: #374151; color: #e5e7eb; border-radius: 999px;
  font-size: .7rem; padding: 2px 10px;
}
.dash-edit-hint { font-size: .78rem; color: #9ca3af; flex: 1; min-width: 180px; }
.dash-edit-controls label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; color: #d1d5db; background: #1f2937;
  border-radius: 6px; padding: 4px 8px;
}
.dash-edit-controls input[type="color"] {
  width: 28px; height: 22px; border: none; padding: 0; background: transparent; cursor: pointer;
}
.dash-edit-controls select {
  border: 1px solid #4b5563; background: #111827; color: #f3f4f6;
  border-radius: 4px; font-size: .75rem; padding: 2px 4px;
}
.dash-edit-note {
  font-size: .78rem; color: #6b7280; line-height: 1.45; margin: 10px 0 0;
}
.dash-edit-toolbar .dash-edit-note { color: #9ca3af; }
.dash-update-banner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  align-items: center;
  background: var(--fb-accent-light, #fff0f2);
  border: 1px solid var(--fb-accent, #e31837);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: .875rem;
  color: var(--fb-text, #333);
}
.dash-update-banner strong { color: var(--fb-accent, #e31837); }
.dash-update-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-notify-list { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.dash-notify-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: var(--fb-accent-light, #fff0f2);
  border: 1px solid var(--fb-accent, #e31837);
  border-left: 4px solid var(--fb-accent, #e31837);
  border-radius: 8px; padding: 10px 12px;
  font-size: .875rem;
  color: var(--fb-text, #333);
}
.dash-notify-item strong { color: var(--fb-accent, #e31837); }
.dash-notify-msg { color: var(--fb-text-muted, #4b5563); font-size: .8rem; margin-top: 2px; }
.dash-save-options { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.dash-save-option {
  display: block; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px;
  cursor: pointer; background: #fff;
}
.dash-save-option:has(input:checked) {
  border-color: var(--fb-accent, #e31837);
  background: var(--fb-accent-light, #fff5f5);
}
.dash-save-option strong { display: block; margin-bottom: 4px; }
.dash-save-option span { display: block; font-size: .8rem; color: #6b7280; line-height: 1.4; margin-top: 2px; margin-left: 22px; }
.dash-save-option input { margin-right: 6px; }
.dash-check { display: block; margin: 6px 0; font-size: .875rem; }
.dash-editing [contenteditable="true"] {
  outline: 1px dashed #cbd5e1; border-radius: 3px; padding: 1px 4px; min-width: 40px;
}
.dash-editing [contenteditable="true"]:focus {
  outline: 2px solid var(--fb-accent, #e31837); background: #fff;
}
.dash-add-dd { position: relative; display: inline-block; z-index: 50; }
.dash-add-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 280px; max-height: 420px; overflow: auto;
  background: #fff; color: #111827; border: 1px solid #e5e7eb;
  border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,.18); padding: 8px;
}
.dash-add-menu-title { font-weight: 700; font-size: .85rem; padding: 6px 8px 2px; }
.dash-add-menu-hint { font-size: .72rem; color: #6b7280; padding: 0 8px 8px; margin: 0; line-height: 1.35; }
.dash-add-group { border-top: 1px solid #f3f4f6; padding: 6px 0; }
.dash-add-group-label {
  font-size: .65rem; letter-spacing: .06em; text-transform: uppercase;
  color: #9ca3af; padding: 4px 8px; font-weight: 700;
}
.dash-add-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: .85rem; color: #111827;
}
.dash-add-option:hover { background: var(--fb-accent-light, #fff0f2); color: var(--fb-accent, #e31837); }
.dash-add-option i { width: 16px; text-align: center; color: #6b7280; }
.dash-add-option:hover i { color: var(--fb-accent, #e31837); }
.dash-mod-icon { margin-right: 6px; font-size: .9rem; }
.dash-open-mod {
  margin-top: 10px; background: none; border: none; padding: 0;
  color: var(--fb-accent, #e31837); font-size: .8rem; font-weight: 600; cursor: pointer;
}
.dash-highlights { margin-top: 8px; }
.dash-hl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.dash-hl-col-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  color: #9ca3af; font-weight: 700; margin-bottom: 6px;
}
.dash-hl-item {
  background: #f8fafc; border-radius: 6px; padding: 8px;
  margin-bottom: 6px; border: 1px solid #eef2f7;
}
.dash-hl-high { border-left: 3px solid #0d8050; }
.dash-hl-low { border-left: 3px solid #2563eb; }
.dash-hl-warn { border-left: 3px solid #dc2626; }
.dash-hl-label { display: block; font-size: .68rem; color: #6b7280; margin-bottom: 2px; }
.dash-hl-value { display: block; font-size: .8rem; font-weight: 600; color: #111827; line-height: 1.3; }
.dash-hl-stats {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.dash-hl-stat {
  flex: 1; min-width: 72px; background: var(--fb-accent-light, #fff0f2);
  border-radius: 6px; padding: 6px 8px; font-size: .72rem; color: #6b7280;
}
.dash-hl-stat strong { display: block; color: var(--fb-accent, #e31837); font-size: .85rem; margin-top: 2px; }
.dash-hl-note { font-size: .75rem; color: #6b7280; margin: 0; line-height: 1.4; }
@media (max-width: 700px) {
  .dash-hl-cols { grid-template-columns: 1fr; }
  .dash-add-menu { width: min(280px, 80vw); }
}

/* Profile / Preferences — DIC layout, DIC brand colors (red, not blue) */
.fb-profile-page { max-width: 720px; }
.fb-profile-identity, .fb-profile-security, .fb-profile-prefs { margin-bottom: 16px; }
.fb-profile-identity .form-row { margin-bottom: 14px; }
.fb-profile-photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 18px;
}
.fb-profile-photo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border: 1px solid var(--fb-border);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
.fb-profile-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 1.6rem;
}
.dic-profile-inline-link {
  display: inline-block;
  margin: -6px 0 14px;
  font-size: .85rem;
}
.fb-profile-security h2,
.fb-profile-prefs h2 { font-size: 1.15rem; margin: 0 0 14px; color: var(--fb-text); }
.fb-profile-lead { font-size: .9rem; color: var(--fb-text-muted); margin-bottom: 14px; line-height: 1.45; }
.fb-auth-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.fb-auth-card {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--fb-border); border-radius: 8px; padding: 14px 16px;
  cursor: pointer; background: #fff; position: relative;
  width: 100%; text-align: left; font: inherit; color: inherit;
}
.fb-auth-options { display: flex; flex-direction: column; gap: 10px; }
.fb-auth-card input { margin-top: 3px; accent-color: var(--fb-accent); }
.fb-auth-card.selected {
  border-color: var(--fb-accent);
  background: var(--fb-accent-light);
}
.fb-auth-card strong { display: block; color: var(--fb-text); margin-bottom: 2px; }
.fb-auth-card span { display: block; font-size: .8rem; color: var(--fb-text-muted); }
.fb-auth-selected {
  margin-left: auto; color: var(--fb-green-paid); font-style: normal;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.fb-auth-setup {
  margin-left: auto; border: 1px solid var(--fb-border); border-radius: 4px;
  padding: 4px 10px; font-size: .75rem; color: var(--fb-text); background: #fff;
}
.fb-profile-prefs h2 { font-size: 1.15rem; margin: 0 0 14px; color: var(--fb-text); }
.fb-profile-prefs .form-row { margin-bottom: 14px; }
.fb-profile-prefs select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--fb-border);
  border-radius: 4px; font-size: .95rem; background: #fff; color: var(--fb-text);
}
.fb-profile-prefs select:focus {
  outline: none; border-color: var(--fb-accent);
  box-shadow: 0 0 0 3px var(--fb-accent-light);
}

/* —— DIC-style dashboard cards (DIC red accents) —— */
.fb-icon-btn { position: relative; }
.fb-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--fb-accent, #e31837);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.fb-notif-badge[hidden] { display: none !important; }

/* FB core widgets: heading sits above the bordered card */
.dash-widget-fb {
  border: none;
  background: transparent;
  padding: 0;
  margin-bottom: 26px;
}
.dash-widget-fb > .dash-card-box {
  border: 1px solid var(--fb-border);
  border-left: none;
  border-left: 1px solid var(--fb-border);
  border-radius: 4px;
  background: var(--fb-white);
  padding: 18px 22px 20px;
  margin: 0;
}

.dash-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 0 0 10px;
}
.dash-card-head-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.dash-card-head .fb-card-title { margin: 0; font-size: 16px; font-weight: 700; }
.dash-card-subselect {
  font-size: .8rem; color: var(--fb-text-muted);
  border: none; background: none; padding: 0;
}
.dash-card-link {
  background: none; border: none; color: var(--fb-accent);
  font-size: .8rem; font-weight: 600; cursor: pointer; padding: 0;
  font-family: var(--fb-font); white-space: nowrap; flex-shrink: 0;
}
.dash-card-link:hover { text-decoration: underline; color: var(--fb-accent-dark); }

.dash-aging-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(140px, .85fr) minmax(180px, .9fr);
  gap: 18px; align-items: center;
}
@media (max-width: 960px) {
  .dash-aging-row { grid-template-columns: 1fr; }
}

.dash-stack-bar {
  display: flex; height: 28px; border-radius: 3px; overflow: hidden;
  background: #f0f1f3; width: 100%;
}
.dash-stack-seg { height: 100%; min-width: 2px; }
.dash-stack-overdue { background: #f4a8b4; }
.dash-stack-open { background: #f5d76e; }
.dash-stack-legend {
  display: flex; gap: 14px; margin-top: 8px; font-size: .75rem; color: var(--fb-text-muted);
}
.dash-stack-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px;
  vertical-align: middle;
}
.dash-stack-legend .lg-od { background: #f4a8b4; }
.dash-stack-legend .lg-os { background: #f5d76e; }

.dash-big-total {
  font-size: 1.65rem; font-weight: 700; color: var(--fb-text); line-height: 1.15;
}
.dash-big-total span { display: block; font-size: .8rem; font-weight: 500; color: var(--fb-text-muted); margin-top: 4px; }
.dash-big-total.profit { color: var(--fb-accent); }

.dash-aging-list {
  list-style: none; margin: 0; padding: 0;
  font-size: .8rem; color: var(--fb-text);
}
.dash-aging-list li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 3px 0; border-bottom: 1px solid #f0f1f3;
}
.dash-aging-list li:last-child { border-bottom: none; }
.dash-aging-list .amt { font-weight: 600; font-variant-numeric: tabular-nums; }

.dash-bank-row {
  display: flex; align-items: flex-start; gap: 18px; flex-wrap: nowrap;
}
.dash-bank-icon {
  width: 44px; height: 44px; border-radius: 6px;
  background: var(--fb-accent-light); color: var(--fb-accent);
  display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  flex-shrink: 0;
}
.dash-bank-copy { flex: 1; min-width: 200px; font-size: 14px; color: var(--fb-text-muted); line-height: 1.5; }
.dash-bank-copy strong { color: var(--fb-text); display: block; margin-bottom: 4px; font-size: 15px; }
.dash-bank-copy p { margin: 0 0 14px; }
.dash-bank-btn { padding: 8px 14px; font-size: 13px; font-weight: 400; }

.dash-pl-row {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
@media (max-width: 800px) { .dash-pl-row { grid-template-columns: 1fr; } }
.dash-mini-bars {
  display: flex; align-items: flex-end; gap: 6px; height: 88px; padding-top: 4px;
}
.dash-mini-bars .bar {
  flex: 1; background: #f8c5cc; border-radius: 2px 2px 0 0; min-height: 4px;
  position: relative;
}
.dash-mini-bars .bar .dot {
  position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--fb-accent);
}
.dash-month-axis {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: .65rem; color: var(--fb-text-muted);
}

.dash-spend-row, .dash-time-row {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; align-items: center;
}
@media (max-width: 800px) {
  .dash-spend-row, .dash-time-row { grid-template-columns: 1fr; }
}
.dash-donut {
  width: 100px; height: 100px; border-radius: 50%;
  background: conic-gradient(var(--fb-accent) 0deg, #f3c4cb 0deg);
  position: relative; margin: 0 auto;
}
.dash-donut::after {
  content: ''; position: absolute; inset: 22px; border-radius: 50%; background: #fff;
}
.dash-legend { font-size: .875rem; color: var(--fb-text); }
.dash-legend-item { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.dash-legend-swatch {
  width: 10px; height: 10px; border-radius: 2px; background: var(--fb-accent); flex-shrink: 0;
}
.dash-script-note {
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  color: var(--fb-accent); font-size: .95rem; max-width: 160px; line-height: 1.35;
  text-align: right;
}
.dash-cashflow {
  height: 72px; position: relative;
  border-bottom: 1px dashed var(--fb-border);
  margin: 8px 0 4px;
}
.dash-cashflow-line {
  position: absolute; left: 0; right: 0; top: 50%;
  border-top: 2px dashed #c5cad1;
}
.dash-stack-bar-lg { height: 32px; }
.dash-stack-scale {
  display: flex; justify-content: space-between;
  font-size: .65rem; color: var(--fb-text-muted); margin-bottom: 4px;
}
.dash-updated {
  display: inline-block; font-size: .65rem; font-weight: 800; letter-spacing: .4px;
  color: var(--fb-accent); background: var(--fb-accent-light);
  border-radius: 3px; padding: 2px 6px; margin-right: 6px;
}
.dash-pl-meta { font-size: .75rem; color: var(--fb-text-muted); margin-top: 8px; }
.dash-insight {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef0f3;
}
.dash-insight-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--fb-text-muted); margin-bottom: 8px;
}
.dash-insight-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: .82rem; padding: 3px 0;
}
.dash-insight-row strong { font-variant-numeric: tabular-nums; }
.dash-rev-head {
  font-size: .85rem; color: var(--fb-text-muted); margin-bottom: 12px;
}
.dash-rev-list { display: flex; flex-direction: column; gap: 8px; }
.dash-rev-row {
  display: grid; grid-template-columns: minmax(100px, 1.2fr) 2fr auto;
  gap: 10px; align-items: center; font-size: .82rem;
}
.dash-rev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-rev-bar-wrap { height: 8px; background: #f0f1f3; border-radius: 4px; overflow: hidden; }
.dash-rev-bar { height: 100%; background: var(--fb-accent); border-radius: 4px; }
.dash-rev-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }


.fb-modal-intro {
  margin: 0 0 16px;
  font-size: .875rem;
  color: var(--fb-text-muted);
  line-height: 1.5;
}

/* Save indicator in the top bar, and the modal hint under password fields. */
.fb-sync-status {
  font-size: 12px;
  color: #767676;
  margin-right: 10px;
  white-space: nowrap;
}
.fb-sync-status.is-error { color: #c0392b; font-weight: 600; }
.fb-sync-status.is-saving { color: #767676; }
.fb-sync-status.is-saved { color: #2e7d32; }

.fb-modal-hint {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #767676;
}

/* Boot screen shown while the session and books load. */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #ffffff;
}
.boot-screen.is-done { display: none; }
.boot-logo {
  width: 190px;
  max-width: 60vw;
  opacity: .95;
}
.boot-text {
  margin: 0;
  font-size: 14px;
  color: #767676;
}

/* —— Client portal: their own details, and being asked for them —— */
.cp-nav-item { position: relative; }
.cp-nav-dot {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d97706;
}
.cp-ask-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid #fcd34d;
  border-left: 3px solid #d97706;
  border-radius: 8px;
  background: #fffbeb;
  font-size: .9rem;
}
.cp-ask-strip i { color: #d97706; margin-right: 6px; }
.cp-banner-ask {
  border-color: #fcd34d;
  border-left: 3px solid #d97706;
  background: #fffbeb;
}
.cp-details-card { max-width: 620px; }
.cp-details-card .form-row { margin-bottom: 14px; }
.cp-details-card label {
  display: block;
  margin-bottom: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
}
.cp-details-card input,
.cp-details-card textarea,
.cp-details-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d5d9de;
  border-radius: 4px;
  font-size: .95rem;
  font-family: inherit;
}
.cp-details-card input:focus,
.cp-details-card textarea:focus,
.cp-details-card select:focus {
  outline: none;
  border-color: #64748b;
  box-shadow: 0 0 0 3px #e8edf3;
}
.cp-details-card .dic-cf-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.cp-details-card .dic-cf-check input { width: auto; }
.cp-details-note {
  margin: 4px 0 18px;
  font-size: .82rem;
  color: #6b7280;
}

@media (max-width: 900px) {
  .fb-nav-toggle { display: inline-flex; margin-left: 12px; }
  .fb-topbar {
    justify-content: space-between;
    padding: 0 8px 0 0;
  }
  .fb-topbar-actions {
    max-width: none;
    padding-right: 12px !important;
  }
  .fb-sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: none;
  }
  body.nav-open .fb-sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.22);
  }
  body.nav-open .fb-nav-scrim {
    display: block;
  }
  .fb-workspace {
    margin-left: 0;
  }
  .fb-content {
    padding: 16px 14px 40px;
    max-width: none;
  }
  .fb-page-actions .fb-btn {
    padding: 10px 14px;
  }
}

@media (max-width: 640px) {
  .fb-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .fb-page-actions {
    width: 100%;
  }
  .fb-page-actions .fb-btn {
    flex: 1 1 auto;
  }
  .modal {
    width: calc(100% - 16px);
    max-height: calc(100vh - 24px);
  }
}

