:root {
  color-scheme: light;
  /* Facebook blue + white theme. The variable names still say "green"
     because that's how 5k+ existing rules reference them — rebinding
     the values is a one-line theme swap; renaming would touch every
     selector in the file. */
  --bg: #f0f2f5;            /* FB surface gray */
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #e4e6eb;
  --line: #dadde1;
  --line-strong: #c5c8cc;
  --text: #1c1e21;
  /* Bumped from #65676b (4.57:1 on white — barely passes WCAG AA) to
     #595c61 (~5.5:1) so the hundreds of helper-text / .muted / caption
     spans across the app meet AA with margin. Was a borderline contrast
     issue flagged in the UX audit. */
  --muted: #595c61;
  --subtle: #8a8d91;
  --green: #1877f2;         /* FB primary blue */
  --green-strong: #0866ff;  /* FB darker accent */
  --green-soft: #e7f3ff;    /* very light blue */
  --amber: #a86314;
  --red: #fa383e;           /* FB red */
  --ink: #1c1e21;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --topbar-h: 71px;
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 124px;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.auth-locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label.file-button {
  border: 0;
  cursor: pointer;
}

/* Login screen */
.login-screen {
  align-items: center;
  background:
    linear-gradient(120deg, rgba(244, 246, 243, 0.96), rgba(232, 240, 230, 0.96)),
    radial-gradient(circle at 20% 10%, rgba(240, 195, 107, 0.25), transparent 35%),
    radial-gradient(circle at 85% 90%, rgba(24, 119, 242, 0.15), transparent 40%);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 20;
  overflow: hidden;
}

.login-screen::before,
.login-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  animation: loginFloat 14s ease-in-out infinite;
}

.login-screen::before {
  width: 320px;
  height: 320px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(24, 119, 242, 0.45), transparent 70%);
}

.login-screen::after {
  width: 280px;
  height: 280px;
  bottom: -100px;
  right: -60px;
  background: radial-gradient(circle, rgba(240, 195, 107, 0.55), transparent 70%);
  animation-delay: -7s;
}

@keyframes loginFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(20px, -25px, 0); }
}

.auth-locked .login-screen {
  display: flex;
}

.auth-locked .shell,
.auth-locked .modal,
.auth-locked .toast {
  visibility: hidden;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px -20px rgba(24, 119, 242, 0.25), 0 8px 24px rgba(0, 0, 0, 0.05);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 32px;
  width: min(100%, 420px);
  position: relative;
  z-index: 1;
  animation: loginCardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes loginCardIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .brand-mark {
  margin-bottom: 4px;
  position: relative;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--green-strong, #1877f2), #1877f2);
  box-shadow: 0 10px 24px -10px rgba(24, 119, 242, 0.5);
  overflow: hidden;
}

.login-card .brand-mark .brand-mark-text {
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  z-index: 2;
}

.login-card .brand-mark .brand-mark-pulse {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, rgba(255, 255, 255, 0.0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.0));
  animation: brandSweep 3.6s linear infinite;
  z-index: 1;
}

@keyframes brandSweep {
  to { transform: rotate(360deg); }
}

.login-card h1 {
  font-size: 30px;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
}

.login-card p,
.login-card small {
  color: var(--muted);
  margin: 0;
}

.login-tagline {
  font-size: 14px;
  font-weight: 500;
}

.login-tagline-wink {
  display: inline-block;
  color: var(--green-strong, #1877f2);
  font-weight: 700;
  margin-left: 2px;
  animation: tagWink 4s ease-in-out infinite;
}

@keyframes tagWink {
  0%, 70%, 100% { transform: rotate(0deg); }
  78% { transform: rotate(-12deg); }
  85% { transform: rotate(8deg); }
  92% { transform: rotate(0deg); }
}

.login-card label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-top: 4px;
  text-transform: uppercase;
}

.login-fields {
  display: grid;
  gap: 12px;
}

.login-fields > input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 46px;
  outline: 0;
  padding: 0 14px;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-fields > input:focus,
.login-password-row input:focus {
  border-color: var(--green-strong, #1877f2);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.12);
}

.login-password-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 44px;
}

.login-password-row input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 46px;
  min-width: 0;
  outline: 0;
  padding: 0 14px;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-submit {
  justify-content: center;
  margin-top: 4px;
  width: 100%;
  height: 46px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -12px rgba(24, 119, 242, 0.6);
}

.login-submit:active:not(:disabled) {
  transform: translateY(0);
}

/* Keyboard focus rings — login form was previously invisible to keyboard
   users (only the inputs had focus styles). Audit P2-26 fix. */
.login-card .icon-button:focus-visible,
.login-submit:focus-visible,
.passkey-login:focus-visible,
.login-gate-actions .primary:focus-visible,
.login-gate-actions .ghost:focus-visible {
  outline: 2px solid var(--green-strong);
  outline-offset: 2px;
}


.login-gate {
  background: var(--green-soft, rgba(24, 119, 242, 0.08));
  border: 1px solid rgba(24, 119, 242, 0.2);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  text-align: left;
}

html[data-consent="granted"] #loginConsentGate {
  display: none !important;
}

.login-gate-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green-strong, #1877f2);
}

.login-gate-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.login-gate-body {
  font-size: 13px;
  color: var(--muted);
  margin: 0 !important;
}

.login-gate-status {
  font-size: 12px;
  color: var(--green-strong, #1877f2);
  min-height: 16px;
}

.login-gate-status:empty {
  display: none;
}

.login-gate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-gate-actions .primary {
  flex: 1;
  justify-content: center;
}

.passkey-login {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

#passkeyHint {
  color: var(--muted);
  font-size: 12px;
}

.passkey-setup-button {
  gap: 8px;
  min-height: 42px;
}

.passkey-setup-button.is-ready {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.35);
  color: var(--green-strong);
}

.passkey-setup-button.is-ready svg {
  color: var(--green);
}

.passkey-modal-status {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 22px 18px;
  text-align: center;
}

.passkey-modal-status.is-ready {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.3);
}

.passkey-modal-status strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.passkey-modal-status span {
  color: var(--muted);
  font-size: 13px;
  max-width: 380px;
}

.passkey-modal-icon {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin-bottom: 6px;
  width: 44px;
}

.passkey-modal-status.is-ready .passkey-modal-icon {
  background: #fff;
  border-color: rgba(24, 119, 242, 0.4);
  color: var(--green);
}

.passkey-modal-icon svg {
  height: 22px;
  width: 22px;
}

.passkey-modal-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.passkey-modal-meta > div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.passkey-modal-meta strong {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.passkey-modal-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 18px;
}

.passkey-modal-steps li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.passkey-modal-message {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  padding: 10px 12px;
}

.login-card.shake {
  animation: shake 0.26s linear;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.login-card .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 15px;
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--subtle);
  font-size: 11px;
}

.brand-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--subtle);
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid var(--line);
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}

.brand-pill[hidden] {
  display: none;
}

.nav {
  display: grid;
  /* 2026-05-13 once-and-for-all sidebar-gap fix: pin rows to content
     height (no auto-stretch) and pack them at the top of the .nav
     container. Without these two lines, `display: grid` + `flex: 1`
     defaults to align-content: stretch, which redistributes the
     sidebar's leftover height across the rows. With many items the
     stretching is small (admin's "spacious" look — actually a side
     effect). With few items it explodes (Auditor with 2 items got
     ~300px gaps). The Brain Team Fix 8 v2 patched only the
     brain-team-mode case via a flex-column override; every other
     sparse role (Auditor, Acquisition, Finance, etc.) still fell
     through to the stretched default. This fix covers all roles. */
  grid-auto-rows: max-content;
  align-content: start;
  gap: 1px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Brain Team Fix 8 (2026-05-07, revised): the grid layout above is
   the original admin look — items get a comfortable spread when the
   sidebar has 14+ entries. But for Brain Team viewers with only
   5–6 items, grid auto-rows distribute the leftover height across
   each row, stretching them well past .nav button { height: 36px }.
   Limit the flex-column override to body.brain-team-mode so admin
   keeps its original spacing while Brain Team sidebar stays tight. */
body.brain-team-mode .nav {
  display: flex;
  flex-direction: column;
}

.nav .nav-section {
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  /* Brain Team Fix 7 (2026-05-07): tightened from 14px → 6px (matches
     user-mode .nav-section). Original 14px caused a visible gap above
     each section header — most obvious for Brain Team viewers who only
     have 2 sections, where the gap dominated the sidebar. */
  margin: 6px 10px 4px;
  text-transform: uppercase;
}

.nav .nav-section:first-child {
  margin-top: 4px;
}

.nav button {
  align-items: center;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text);
  display: grid;
  gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  height: 36px;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}

.nav button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.nav button:hover {
  background: var(--surface-3);
}

.nav button.active {
  background: var(--green-soft);
  color: var(--green-strong);
  font-weight: 600;
}

.nav button.active svg {
  color: var(--green);
}

.count-pill {
  background: var(--surface-3);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  min-width: 22px;
  padding: 2px 6px;
  text-align: center;
}

.nav button.active .count-pill {
  background: rgba(24, 119, 242, 0.14);
  color: var(--green-strong);
}

.sidebar-card {
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: auto;
}

.sidebar-card .label {
  color: var(--muted);
}

.sidebar-card strong {
  display: block;
  font-size: 18px;
  margin: 4px 0 2px;
  letter-spacing: -0.01em;
}

.sidebar-card small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-month-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.sidebar-month-card[hidden] {
  display: none;
}

body.user-mode .nav {
  flex: 0 0 auto;
  gap: 2px;
}

body.user-mode .nav button {
  height: 32px;
}

body.user-mode .nav .nav-section {
  margin: 6px 10px 4px;
}

.sidebar-month-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-month-row + .sidebar-month-row {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 8px;
}

.sidebar-month-row .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-month-row strong {
  display: block;
  font-size: 16px;
  margin: 2px 0 0;
}

.active-user-banner {
  align-items: center;
  background: var(--green-soft);
  border-bottom: 1px solid rgba(24, 119, 242, 0.3);
  color: var(--green-strong);
  display: flex;
  font-size: 13px;
  gap: 12px;
  padding: 8px 18px;
}

.active-user-banner[hidden] {
  display: none;
}

/* The user portal already shows "Signed in as X" inside the head, so the
 * top-of-page banner is redundant when the active user logged in directly. */
body.user-mode.user-mode-direct .active-user-banner {
  display: none;
}

.active-user-icon {
  align-items: center;
  background: var(--surface);
  border-radius: 999px;
  color: var(--green-strong);
  display: flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.active-user-icon svg {
  height: 14px;
  width: 14px;
}

.active-user-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.2;
}

.active-user-meta strong {
  font-size: 14px;
}

.auth-badges {
  display: inline-flex;
  gap: 6px;
}

.auth-badge {
  align-items: center;
  background: var(--surface-3);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.auth-badge svg {
  height: 12px;
  width: 12px;
}

.auth-badge.is-set {
  background: var(--green-soft);
  color: var(--green-strong);
}

.creds-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  padding: 10px 12px;
}

.creds-status {
  align-items: center;
  display: flex;
  flex: 1;
  font-weight: 600;
  gap: 8px;
}

.creds-status.is-empty {
  color: var(--muted);
}

.creds-status.is-set {
  color: var(--green-strong);
}

.creds-status svg {
  height: 16px;
  width: 16px;
}

.creds-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.creds-generated {
  align-items: center;
  background: #fff8df;
  border: 1px solid #d8c75a;
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 12px;
}

.creds-generated code {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  padding: 4px 8px;
}

.portal-controls {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.portal-controls .field {
  min-width: 220px;
}

.portal-hint {
  flex: 1;
  font-size: 12px;
  margin: 0;
}

.upload-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  padding: 16px;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.upload-card.is-uploaded {
  border-color: rgba(24, 119, 242, 0.4);
  background: var(--green-soft);
}

.upload-card.is-pending {
  border-color: #e7c388;
  background: #fff7ea;
}

.upload-card.is-frozen {
  border-color: #c9c9c9;
  background: #f4f4f5;
  opacity: 0.85;
}

.upload-card.is-frozen .upload-btn.is-disabled {
  background: #d4d4d8;
  color: #71717a;
  cursor: not-allowed;
}

.upload-card.is-drag-over {
  border-color: #1877f2;
  border-style: dashed;
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15);
  background: rgba(24, 119, 242, 0.06);
}
.bulk-upload-panel.is-drag-over {
  border: 2px dashed #1877f2;
  background: rgba(24, 119, 242, 0.04);
}

.upload-edit-window,
.upload-edit-frozen {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.upload-edit-window {
  background: rgba(24, 119, 242, 0.1);
  color: #1877f2;
}

.upload-edit-frozen {
  background: #e4e4e7;
  color: #52525b;
}

.upload-edit-window i,
.upload-edit-frozen i {
  width: 12px;
  height: 12px;
}

.upload-amount.is-frozen {
  opacity: 0.7;
}

.upload-amount.is-frozen input,
.upload-amount.is-frozen button {
  cursor: not-allowed;
}

.upload-card-head strong {
  display: block;
  font-size: 14px;
}

.upload-card-head .muted {
  font-size: 11px;
}

.upload-thumb img {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: block;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  width: 100%;
}

/* "Not counted yet — confirm the amount" banner. Used to be a quiet
   chip; promoted 2026-05-14 to a full-width amber strip so page users
   don't think a screenshot is "done" before they confirm the amount. */
.upload-preview-tag {
  align-items: center;
  background: rgba(255, 184, 0, 0.18);
  border: 1px solid rgba(217, 119, 6, 0.6);
  border-radius: 8px;
  color: #7c3a00;
  display: flex;
  font-size: 12.5px;
  font-weight: 500;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 12px;
  width: 100%;
  line-height: 1.35;
}

.upload-preview-tag strong {
  color: #5b2c00;
  font-weight: 700;
}

.upload-preview-tag svg {
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
  color: #b45309;
}

/* Amber border + soft pulse on unlocked cards so the page user
   visually picks them out of the grid. */
.upload-card.is-needs-confirm {
  border-color: rgba(217, 119, 6, 0.5);
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.08);
}

@keyframes upload-card-flash {
  0%, 100% { box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.08); }
  50% { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.35); }
}

.upload-card.upload-card-flash {
  animation: upload-card-flash 0.5s ease 0s 3;
}

/* ─────────────────────────────────────────────────────────────────────
   Nudge card — Pending / Done / Active per-user modal.
   Designed for the admin to screenshot and forward to a Page User. The
   layout aims to look polished at iPhone-portrait crop too.
   ───────────────────────────────────────────────────────────────────── */
.nudge-card {
  --nudge-grad-1: #f59e0b;
  --nudge-grad-2: #f97316;
  --nudge-soft: rgba(245, 158, 11, 0.12);
  --nudge-strong: #b45309;
  --nudge-text: #7c3a00;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: nudge-card-in 0.42s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nudge-card.nudge-done {
  --nudge-grad-1: #10b981;
  --nudge-grad-2: #059669;
  --nudge-soft: rgba(16, 185, 129, 0.12);
  --nudge-strong: #047857;
  --nudge-text: #064e3b;
}

.nudge-card.nudge-active {
  --nudge-grad-1: #3b82f6;
  --nudge-grad-2: #2563eb;
  --nudge-soft: rgba(37, 99, 235, 0.10);
  --nudge-strong: #1d4ed8;
  --nudge-text: #1e3a8a;
}

@keyframes nudge-card-in {
  0%   { opacity: 0; transform: translateY(12px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.nudge-hero {
  position: relative;
  background: linear-gradient(135deg, var(--nudge-grad-1), var(--nudge-grad-2));
  color: #fff;
  padding: 22px 22px 24px;
  overflow: hidden;
  isolation: isolate;
  flex-shrink: 0;
}

.nudge-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 240px at 110% -10%, rgba(255, 255, 255, 0.28), transparent 60%),
    radial-gradient(600px 180px at -10% 110%, rgba(0, 0, 0, 0.12), transparent 60%);
  z-index: -1;
}

.nudge-hero-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.nudge-avatar {
  --avatar-h: 200;
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: hsl(var(--avatar-h, 200) 70% 92%);
  color: hsl(var(--avatar-h, 200) 60% 30%);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 0 0 3px rgba(255, 255, 255, 0.85);
  animation: nudge-avatar-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 80ms backwards;
}

.nudge-avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);
  animation: nudge-avatar-ring 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes nudge-avatar-pop {
  0%   { transform: scale(0.6) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.08) rotate(2deg);  opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

@keyframes nudge-avatar-ring {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50%      { transform: scale(1.08); opacity: 0; }
}

.nudge-hero-text { min-width: 0; }

.nudge-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.nudge-eyebrow svg { width: 13px; height: 13px; }

.nudge-headline {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.nudge-sub {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  max-width: 520px;
}

.nudge-date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.nudge-date-pill svg { width: 14px; height: 14px; }

.nudge-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--nudge-soft);
  padding: 14px 22px;
  border-bottom: 1px solid var(--line, #e6e6e8);
  flex-shrink: 0;
}

.nudge-stat {
  text-align: center;
  position: relative;
}

.nudge-stat + .nudge-stat::before {
  content: "";
  position: absolute;
  left: 0; top: 14%; bottom: 14%;
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
}

.nudge-stat span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
  font-weight: 600;
}

.nudge-stat strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text, #111);
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.nudge-stat.is-highlight strong {
  color: var(--nudge-strong);
  animation: nudge-count-pulse 1.8s ease-in-out infinite;
}

@keyframes nudge-count-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.nudge-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 6px;
  flex-shrink: 0;
}

.nudge-filter {
  flex: 1 1 auto;
  padding: 8px 12px;
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nudge-filter:focus {
  outline: none;
  border-color: var(--nudge-strong);
  box-shadow: 0 0 0 3px var(--nudge-soft);
}

.nudge-list-count {
  font-size: 12px;
  white-space: nowrap;
}

.nudge-pages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 22px 18px;
  max-height: 50vh;
  overflow-y: auto;
}

.nudge-page {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: nudge-page-in 0.42s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes nudge-page-in {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.nudge-page:hover {
  border-color: var(--nudge-strong);
  background: var(--nudge-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
}

.nudge-page-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--nudge-soft);
  color: var(--nudge-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.nudge-page-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.nudge-page-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text, #111);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nudge-page-show {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.nudge-page-show svg { width: 12px; height: 12px; flex-shrink: 0; }

.nudge-page-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nudge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nudge-pill svg { width: 12px; height: 12px; }

.nudge-pill-pending { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.nudge-pill-done    { background: rgba(16, 185, 129, 0.16); color: #047857; }
.nudge-pill-neutral { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }

.nudge-page-open {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted, #6b7280);
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.nudge-page-open svg { width: 14px; height: 14px; }

.nudge-page:hover .nudge-page-open {
  color: var(--nudge-strong);
  background: var(--nudge-soft);
  transform: translateX(2px);
}

.nudge-quote {
  margin: 0 22px 14px;
  padding: 14px 18px;
  border-left: 3px solid var(--nudge-strong);
  background: var(--nudge-soft);
  border-radius: 8px;
  color: var(--nudge-text);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.45;
  font-weight: 500;
  flex-shrink: 0;
}

.nudge-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 22px 14px;
  border-top: 1px solid var(--line, #e6e6e8);
  background: var(--surface-2, #fafafa);
  flex-shrink: 0;
}

.nudge-foot .muted {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.nudge-foot svg { width: 13px; height: 13px; }

.nudge-empty {
  padding: 38px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.nudge-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--nudge-soft);
  color: var(--nudge-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nudge-empty-icon svg { width: 26px; height: 26px; }

.nudge-empty strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #111);
}

@media (max-width: 540px) {
  .nudge-hero-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .nudge-avatar { margin: 0 auto; }
  .nudge-date-pill { margin: 4px auto 0; }
  .nudge-pages, .nudge-toolbar { padding-left: 14px; padding-right: 14px; }
  .nudge-quote { margin-left: 14px; margin-right: 14px; }
  .nudge-foot { padding-left: 14px; padding-right: 14px; }
  .nudge-page { grid-template-columns: 28px 1fr auto; padding: 10px 12px; }
}

/* Top-of-portal "N screenshots need your confirmation" banner. */
.upload-confirm-banner {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.14), rgba(255, 142, 0, 0.10));
  border: 1px solid rgba(217, 119, 6, 0.55);
  border-radius: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.upload-confirm-banner-inner {
  align-items: center;
  display: flex;
  gap: 14px;
}

.upload-confirm-icon {
  align-items: center;
  background: #f59e0b;
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.upload-confirm-icon svg {
  height: 20px;
  width: 20px;
}

.upload-confirm-meta {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.upload-confirm-title {
  color: #7c3a00;
  font-size: 15px;
  font-weight: 700;
}

.upload-confirm-sub {
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.4;
}

.upload-confirm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.upload-confirm-list li {
  font-size: 12px;
}

.upload-confirm-list .link-button {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 6px;
  color: #7c3a00;
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px;
  text-align: left;
}

.upload-confirm-list .link-button:hover {
  background: #fff;
  border-color: rgba(217, 119, 6, 0.7);
}

.upload-confirm-banner .primary {
  flex: 0 0 auto;
}

/* Stat-chip variant when the date banner has unlocked uploads — slight
   dim of "Complete" check so it doesn't read as a contradiction. */
.upload-date-banner.has-needs-confirm .upload-date-stat.is-ok {
  opacity: 0.65;
}

/* Sequential-upload lock: a card in is-blocked state means another page is
   mid-upload. Visual cue: subtle dashed border + reduced opacity on the
   upload button so it reads "this is paused". */
.upload-card.is-blocked {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  opacity: 0.85;
}

.upload-card.is-blocked .upload-btn.is-disabled {
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
}

.upload-thumb-remote {
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  height: 120px;
  justify-content: center;
  width: 100%;
}

.upload-thumb-remote:hover {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.35);
  color: var(--green-strong);
}

.upload-thumb-remote svg {
  height: 24px;
  width: 24px;
}

.upload-meta {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: 8px;
  justify-content: space-between;
}

.upload-btn {
  cursor: pointer;
  display: inline-flex;
  margin-top: auto;
}

.upload-btn input[type="file"] {
  display: none;
}

.upload-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.upload-stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.upload-stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
}

.upload-stat .muted {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.upload-stat strong {
  font-size: 22px;
  font-weight: 700;
}

.upload-stat small {
  color: var(--muted);
  font-size: 12px;
}

.upload-stat.is-pending {
  border-color: #e7c388;
}

.upload-stat.is-pending strong {
  color: var(--amber);
}

.upload-stat.is-overdue {
  background: #fff1f1;
  border-color: #edb8b8;
}

.upload-stat.is-overdue strong {
  color: var(--red);
}

.upload-stat.is-done {
  border-color: rgba(24, 119, 242, 0.35);
}

.upload-stat.is-done strong {
  color: var(--green-strong);
}

.upload-stat.is-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.upload-stat.is-clickable:hover {
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.16);
  transform: translateY(-1px);
}

.upload-stat.is-clickable:focus-visible {
  outline: 2px solid var(--green-strong);
  outline-offset: 2px;
}

.portal-points-badge {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid rgba(24, 119, 242, 0.3);
  border-radius: var(--radius);
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.1;
  padding: 6px 14px;
  text-align: right;
}

.portal-points-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-points-badge strong {
  color: var(--green-strong);
  font-size: 18px;
  font-weight: 700;
}

.portal-points-badge small {
  color: var(--muted);
  font-size: 11px;
}

.cal-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  padding: 16px;
}

.cal-day {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  text-align: center;
  transition: border-color 100ms ease, transform 60ms ease;
}

.cal-day:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.cal-day.is-selected {
  border-color: var(--green-strong);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}

.cal-day.cal-complete {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.35);
}

.cal-day.cal-complete .cal-count {
  color: var(--green-strong);
  font-weight: 700;
}

.cal-day.cal-partial {
  background: #fff7ea;
  border-color: #e7c388;
}

.cal-day.cal-partial .cal-count {
  color: var(--amber);
  font-weight: 700;
}

.cal-day.cal-missing {
  background: var(--surface);
}

.cal-day.cal-empty {
  opacity: 0.55;
}

.cal-date {
  font-size: 12px;
  font-weight: 600;
}

.cal-count {
  color: var(--muted);
  font-size: 11px;
}

.cal-tag {
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  text-transform: uppercase;
}

.cal-day.is-locked {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px);
  cursor: not-allowed;
  opacity: 0.55;
}

.cal-day.is-locked:hover {
  border-color: var(--line);
  transform: none;
}

.cal-tag-lock {
  align-items: center;
  background: var(--muted);
  display: inline-flex;
  gap: 4px;
}

.cal-tag-lock i {
  height: 10px;
  width: 10px;
}

.log-points-pos {
  color: var(--green-strong);
}

.log-points-neg {
  color: var(--red);
}

.upload-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.view-toggle {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  gap: 2px;
  padding: 2px;
}

.view-toggle button {
  align-items: center;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
}

.view-toggle button:hover {
  color: var(--text);
}

.view-toggle button.is-active {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--green-strong);
}

.view-toggle button svg {
  height: 14px;
  width: 14px;
}

.upload-grid.layout-compact {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.upload-grid.layout-compact .upload-card {
  gap: 6px;
  padding: 10px;
}

.upload-grid.layout-compact .upload-thumb img {
  max-height: 140px;
}

.upload-grid.layout-list {
  grid-template-columns: minmax(0, 1fr);
}

.upload-grid.layout-list .upload-card {
  display: grid;
  gap: 12px;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  padding: 12px;
}

.upload-grid.layout-list .upload-thumb img {
  max-height: 120px;
}

.upload-grid.layout-list .upload-card-head,
.upload-grid.layout-list .upload-amount,
.upload-grid.layout-list .upload-meta,
.upload-grid.layout-list .upload-btn {
  margin: 0;
}

.upload-amount {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
}

.upload-amount-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.upload-amount-row {
  align-items: stretch;
  display: flex;
  gap: 8px;
}

.upload-amount-input-wrap {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex: 1;
  gap: 4px;
  height: 44px;
  min-width: 0;
  overflow: hidden;
  padding: 0 10px;
}

.upload-amount-input-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15);
}

.upload-amount-currency {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 700;
}

input.upload-amount-input,
.upload-amount-input {
  background: transparent;
  border: 0;
  flex: 1;
  font-size: 22px;
  font-weight: 700;
  height: 42px;
  min-width: 0;
  outline: none;
  padding: 0;
  width: 100%;
}

.upload-amount-input::-webkit-outer-spin-button,
.upload-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.upload-amount-input[type="number"] {
  -moz-appearance: textfield;
}

.upload-amount-editing.has-value {
  border-color: rgba(24, 119, 242, 0.4);
  background: rgba(230, 242, 236, 0.5);
}

.upload-amount-editing.has-value .upload-amount-input-wrap {
  border-color: rgba(24, 119, 242, 0.35);
}

.upload-amount-editing.has-value .upload-amount-input,
.upload-amount-editing.has-value .upload-amount-currency {
  color: var(--green-strong);
}

.upload-amount-editing.no-value {
  border-color: #e7c388;
  background: #fff7ea;
}

.upload-amount-submit {
  align-items: center;
  display: inline-flex;
  flex-shrink: 0;
  gap: 4px;
  height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}

/* Shared visible-CTA submit class used by both single-upload Submit
   (renderUploadAmountSection) and bulk-upload Submit. Same look so users
   recognise the action. */
.upload-cta {
  align-items: center;
  background: var(--green);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(8, 102, 255, 0.18);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  letter-spacing: 0.01em;
  min-height: 48px;
  padding: 0 24px;
  transition: background-color 120ms ease, transform 60ms ease, box-shadow 120ms ease;
  width: 100%;
}
.upload-cta:hover:not(:disabled) {
  background: var(--green-strong);
  box-shadow: 0 4px 12px rgba(8, 102, 255, 0.28);
}
.upload-cta:active:not(:disabled) {
  transform: translateY(1px);
}
.upload-cta:disabled {
  background: #9aa6b3;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.78;
}
.upload-cta i,
.upload-cta svg {
  height: 18px;
  width: 18px;
}
/* Make the existing single-upload Submit visually consistent with the
   bulk Submit by inheriting the same look. The single-upload button keeps
   its inline-flex behavior in .upload-amount-row (no full-width). */
.upload-amount-submit.upload-cta {
  min-height: 44px;
  padding: 0 18px;
  width: auto;
}

/* ---- Bulk upload (User Portal → Upload) ---- */
.bulk-upload-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bulk-upload-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bulk-upload-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.bulk-target-date {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 4px;
}
.bulk-target-date input[type="date"] {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  padding: 8px 10px;
}
.bulk-upload-hint {
  font-size: 12px;
  margin: 0;
}
.bulk-upload-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 16px;
  max-height: 60vh;
  overflow: auto;
}
.bulk-upload-table {
  border-collapse: collapse;
  width: 100%;
}
.bulk-upload-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  position: sticky;
  text-align: left;
  text-transform: uppercase;
  top: 0;
  z-index: 2;
}
.bulk-upload-table td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 8px 10px;
  vertical-align: top;
}
.bulk-upload-table tr.is-skipped td {
  opacity: 0.45;
}
.bulk-upload-table tr.is-done td {
  background: var(--green-soft);
}
.bulk-thumb-cell img {
  border: 1px solid var(--line);
  border-radius: 4px;
  height: 64px;
  object-fit: cover;
  width: 96px;
}
.bulk-ocr-cell {
  max-width: 240px;
}
.bulk-ocr-cell strong {
  display: block;
  word-break: break-word;
}
.bulk-ocr-cell small {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}
.bulk-page-cell select,
.bulk-date-cell input,
.bulk-amount-cell input {
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
  padding: 6px 8px;
  width: 100%;
}
.bulk-page-cell select { min-width: 220px; }
.bulk-amount-cell input { max-width: 110px; }
.bulk-date-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
}
.bulk-date-badge.bulk-ok   { background: var(--green-soft); color: var(--green-strong); }
.bulk-date-badge.bulk-warn { background: #fff3d6; color: #8a5a00; }
.bulk-date-badge.bulk-bad  { background: #fde2e2; color: var(--red); }
.bulk-status {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  text-transform: uppercase;
}
.bulk-status.bulk-ok    { background: var(--green-soft); color: var(--green-strong); }
.bulk-status.bulk-warn  { background: #fff3d6; color: #8a5a00; }
.bulk-status.bulk-err   { background: #fde2e2; color: var(--red); }
.bulk-status.bulk-wait  { background: #e0ecff; color: var(--green-strong); }
.bulk-status.bulk-skip  { background: #ececec; color: #6b7280; }
.bulk-skip-cell {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bulk-skip-label {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  gap: 4px;
}
.bulk-dup-badge {
  align-items: center;
  background: #fff3d6;
  border-radius: 999px;
  color: #8a5a00;
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  gap: 4px;
  letter-spacing: 0.04em;
  margin-top: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
}
.bulk-dup-badge svg { height: 10px; width: 10px; }
.bulk-upload-submit-wrap {
  padding: 0 16px 16px;
}
.upload-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-amount.upload-amount-locked {
  align-items: center;
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.35);
  flex-direction: row;
  flex-wrap: wrap;
}

.upload-amount.upload-amount-locked .upload-amount-big {
  color: var(--green-strong);
  flex: 1;
  font-size: 28px;
  font-weight: 800;
}

.upload-amount-tag {
  align-items: center;
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 4px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  text-transform: uppercase;
}

.upload-amount-tag svg {
  height: 12px;
  width: 12px;
}

/* Compound `.panel.upload-date-banner` selector beats the later
   `.panel { background: var(--surface) }` rule so the green gradient
   shows even when the banner doesn't carry the `is-complete` modifier
   — without this, users with 0 uploads today saw a blank white banner. */
.panel.upload-date-banner {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-strong) 100%);
  border: 0;
  color: #fff;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}

.panel.upload-date-banner.is-complete {
  background: linear-gradient(135deg, #1877f2 0%, #135634 100%);
}

.upload-date-content {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 20px;
}

.upload-date-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  display: flex;
  flex-shrink: 0;
  height: 56px;
  justify-content: center;
  width: 56px;
}

.upload-date-icon svg {
  height: 28px;
  width: 28px;
}

.upload-date-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}

.upload-date-eyebrow {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-date-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.upload-date-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
}

.upload-date-stats {
  display: flex;
  gap: 8px;
}

.upload-date-stat {
  align-items: stretch;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
  padding: 8px 12px;
  text-align: right;
}

.upload-date-stat span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.upload-date-stat strong {
  font-size: 20px;
  font-weight: 800;
}

.upload-date-stat.is-ok {
  background: rgba(255, 255, 255, 0.28);
}

.daily-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.daily-summary-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
}

.daily-summary-card span.muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.daily-summary-card strong {
  font-size: 24px;
  font-weight: 700;
}

.daily-summary-card small {
  color: var(--muted);
  font-size: 12px;
}

.daily-summary-card.is-accent {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.3);
}

.daily-summary-card.is-accent strong {
  color: var(--green-strong);
}

.daily-summary-card.is-success {
  background: rgba(24, 119, 242, 0.08);
  border-color: rgba(24, 119, 242, 0.25);
}

.daily-summary-card.is-success strong {
  color: var(--green-strong);
}

.daily-summary-card.is-money {
  background: var(--surface-3, var(--surface-2));
  border-color: var(--line);
}

/* Audit dashboard cards that double as table filters. Hover shows a
   subtle lift so the user knows they're interactive; .is-active-focus
   uses a stronger accent border + label so the active filter is
   unmistakable. */
.daily-summary-card.audit-focus-card {
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.daily-summary-card.audit-focus-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.daily-summary-card.audit-focus-card.is-active-focus {
  border-color: #2563eb;
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.daily-summary-card.audit-focus-card.is-active-focus small {
  color: #2563eb;
  font-weight: 700;
}

.daily-summary-card.is-money strong {
  color: var(--text-strong, currentColor);
  letter-spacing: -0.01em;
}

/* === Clickable numbers inside an overview-card big <strong> value
       (e.g. dailyDueToday's "3 / 91" split) === */
.overview-card .metric-link {
  background: transparent;
  border: 0;
  padding: 0 4px;
  font: inherit;
  color: var(--brand, #1877f2);
  cursor: pointer;
  border-radius: 4px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.overview-card .metric-link:hover,
.overview-card .metric-link:focus-visible {
  background: rgba(24, 119, 242, 0.08);
  outline: none;
}

.overview-card .metric-link.metric-link--inline {
  font-size: inherit;
  color: var(--brand, #1877f2);
  text-decoration-thickness: 1px;
}

.overview-card .metric-divider {
  font-weight: 400;
  color: var(--muted, #6b7280);
  margin: 0 2px;
}

/* === Daily-due modal (filter tabs + pending row tint) === */
.daily-due-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.daily-due-pill {
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.daily-due-pill.is-active {
  background: var(--brand, #1877f2);
  color: #fff;
  border-color: var(--brand, #1877f2);
}

.daily-due-pill:hover:not(.is-active) {
  background: var(--surface-3, #e5e7eb);
}

.day-detail-table tr.row-pending {
  background: #fff7ed;
}

.day-detail-table tr.row-pending td {
  color: #7c2d12;
}

/* === Day-detail modal (Daily tab → click a date / Users count) === */
.day-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.day-detail-stat {
  background: var(--surface-2, #f7f7f8);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.day-detail-stat span {
  font-size: 11px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.day-detail-stat strong {
  font-size: 18px;
  font-weight: 700;
}

.day-detail-stat.is-money {
  background: var(--green-soft, #ecfdf5);
  border-color: var(--green-line, #a7f3d0);
}

.day-detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line, #e6e6e8);
}

.day-detail-section-title h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.day-detail-section-title .muted {
  margin-left: auto;
  font-size: 11px;
}

.day-detail-section-title i {
  width: 14px;
  height: 14px;
  color: var(--muted, #6b7280);
}

.day-detail-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.day-detail-user-card {
  background: #fff;
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-detail-user-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.day-detail-user-head strong {
  font-size: 13px;
  font-weight: 600;
}

.day-detail-user-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-strong, #047857);
}

.day-detail-user-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--muted, #6b7280);
  flex-wrap: wrap;
}

.day-detail-user-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.day-detail-user-meta i {
  width: 11px;
  height: 11px;
}

.day-detail-user-shows {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.day-detail-user-shows .chip,
.day-detail-table .chip {
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.day-detail-table .chip i {
  width: 10px;
  height: 10px;
}

.day-detail-table .chip.is-success {
  background: var(--green-soft, #ecfdf5);
  border-color: var(--green-line, #a7f3d0);
  color: var(--green-strong, #047857);
}

.day-detail-table .chip.is-warn {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.day-detail-actions {
  white-space: nowrap;
}

.day-detail-actions .ghost.small {
  padding: 4px 6px;
  margin: 0 2px;
}

#modal[aria-hidden="false"] .modal-shell:has(.day-detail-summary) {
  max-width: 1100px;
  width: min(94vw, 1100px);
}

.day-detail-coverage {
  margin: 10px 0 4px;
  padding: 10px 12px;
  background: var(--surface-2, #f7f8fa);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-detail-coverage-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-detail-coverage-label i {
  width: 14px;
  height: 14px;
}

.day-detail-coverage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.day-detail-coverage-chip {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 999px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.day-detail-coverage-chip:hover {
  border-color: var(--accent, #2563eb);
}

.day-detail-coverage-chip strong {
  font-size: 13px;
  font-weight: 700;
}

.day-detail-coverage-chip.is-active {
  background: var(--accent-soft, #e0e7ff);
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.day-detail-coverage-chip.is-success { color: #047857; }
.day-detail-coverage-chip.is-success strong { color: #065f46; }
.day-detail-coverage-chip.is-warn { color: #b45309; }
.day-detail-coverage-chip.is-warn strong { color: #92400e; }
.day-detail-coverage-chip.is-accent { color: #1d4ed8; }
.day-detail-coverage-chip.is-accent strong { color: #1e40af; }
.day-detail-coverage-chip.is-danger { color: #b91c1c; }
.day-detail-coverage-chip.is-danger strong { color: #991b1b; }

.day-detail-coverage-note {
  font-size: 12px;
}

.day-detail-tabs {
  display: inline-flex;
  gap: 2px;
  margin: 14px 0 12px;
  padding: 3px;
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
}

.day-detail-tabs button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.day-detail-tabs button:hover {
  color: var(--text, #111);
}

.day-detail-tabs button.is-active {
  background: var(--surface, #fff);
  color: var(--text, #111);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.day-detail-tabs button i {
  width: 14px;
  height: 14px;
}

.day-detail-tabs button .muted {
  font-size: 11px;
  opacity: 0.7;
}

.day-detail-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.day-detail-filters input[type="search"],
.day-detail-filters select {
  padding: 6px 10px;
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 6px;
  background: var(--surface, #fff);
  font-size: 13px;
  height: 32px;
  color: var(--text, #111);
}

.day-detail-filters input[type="search"] {
  min-width: 220px;
  flex: 1 1 220px;
}

.day-detail-filters select {
  min-width: 130px;
}

.day-detail-filters input[type="search"]:focus,
.day-detail-filters select:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.day-detail-filter-count {
  margin-left: auto;
  font-size: 12px;
  white-space: nowrap;
}

.day-detail-table-scroll {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 8px;
}

.day-detail-entry-table {
  width: 100%;
}

.day-detail-entry-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface, #fff);
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line, #e6e6e8);
}

.day-detail-entry-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.day-detail-entry-table th.sortable:hover {
  background: var(--surface-2, #f3f4f6);
}

.day-detail-sort-ind {
  margin-left: 4px;
  color: var(--accent, #2563eb);
  font-size: 10px;
}

.daily-summary-card .metric-divider {
  color: var(--muted);
  font-weight: 500;
  margin: 0 4px;
}

.daily-summary-card .metric-secondary {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.daily-summary-card .metric-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.daily-summary-card .metric-link:hover,
.daily-summary-card .metric-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
  outline: none;
}

.daily-summary-card .metric-link.metric-link-secondary {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.show-name-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent, #2563eb);
  cursor: pointer;
  text-align: left;
}
.show-name-link:hover,
.show-name-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
  outline: none;
}
.page-name-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.page-name-link strong { font-weight: 600; }
.page-name-link:hover strong,
.page-name-link:focus-visible strong {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--accent, #2563eb);
}
.page-name-link:focus-visible { outline: none; }
.page-fb-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--muted);
  text-decoration: none;
}
.page-fb-icon:hover { color: var(--accent, #2563eb); }
.page-fb-icon i { width: 14px; height: 14px; }

.show-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.show-summary-card {
  background: linear-gradient(135deg, var(--surface, #fff) 0%, var(--surface-2, #f7f7f8) 100%);
  border: 1px solid var(--line, #e6e6e8);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.show-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  border-color: rgba(24, 119, 242, 0.25);
}
.show-summary-card.show-summary-money {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.04) 0%, rgba(34, 197, 94, 0.10) 100%);
  border-color: rgba(34, 197, 94, 0.20);
}

/* 2026-05-14: animated entrance for show summary content. Cards stagger
   in via the --i CSS var; sections slide up via --delay. Honors
   prefers-reduced-motion. */
@keyframes showSummaryCardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes showSummarySectionIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.show-summary-animate .show-summary-card {
  animation: showSummaryCardIn 280ms cubic-bezier(.2,.8,.2,1) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
.show-summary-animate-up {
  animation: showSummarySectionIn 360ms cubic-bezier(.2,.8,.2,1) both;
  animation-delay: var(--delay, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .show-summary-animate .show-summary-card,
  .show-summary-animate-up { animation: none; }
}
.show-summary-section h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
}
.show-summary-section h4 i {
  width: 14px; height: 14px;
  color: var(--accent, #2563eb);
}
.show-summary-table tbody tr {
  transition: background 120ms ease;
}
.show-summary-card span.muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.show-summary-card strong { font-size: 18px; font-weight: 700; }
.show-summary-money strong { color: var(--green-strong, #166534); }
.show-summary-pages { margin: 0 0 16px; }
.show-summary-pages h4 { margin: 0 0 8px; font-size: 13px; }
.show-summary-pages ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 12px;
}
.show-summary-pages li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line, #eee);
}
.show-summary-fb { margin: 0 0 16px; }

/* 2026-05-14: enriched show summary modal — date filter + pages table +
   daily-earnings table. */
.show-summary-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 12px 0;
}
.show-summary-toolbar .ghost.small.active {
  background: var(--green-soft);
  color: var(--green-strong);
  border-color: var(--green);
}
.show-summary-section { margin: 14px 0; }
.show-summary-section h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.show-summary-table-wrap {
  max-height: 50vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.show-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.show-summary-table th,
.show-summary-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.show-summary-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.show-summary-table tbody tr:hover {
  background: rgba(24, 119, 242, 0.04);
}
.show-summary-actions {
  display: flex;
  justify-content: flex-end;
  margin: 16px 0 0;
}
.show-summary-actions .danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.show-summary-actions .danger:hover { background: #fecaca; }

/* Info-only modals (e.g. show summary, day detail) hide the footer Save
   button via the `hidden` attribute, but `.primary { display: flex }` was
   winning the cascade and keeping it visible. Force the attribute to win. */
#modalForm button[type="submit"][hidden] { display: none !important; }

.vendor-drilldown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 0;
}
.vendor-drilldown-table th,
.vendor-drilldown-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #eee);
  text-align: left;
}
.vendor-drilldown-table th {
  background: var(--surface-2, #f7f7f8);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #6b7280);
  position: sticky;
  top: 0;
  z-index: 1;
}
.vendor-drilldown-table tr:hover td { background: var(--surface-2, #fafafa); }

/* Dashboard metric cards: show ≈ ₹INR under the $ value */
.metric-inr {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  letter-spacing: 0;
}
/* Month-wise Earnings table cells: ₹INR under the $ value */
.cell-inr {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted, #6b7280);
  font-weight: 400;
}

.active-tracker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-size: 13px;
  margin-top: 6px;
}

.active-tracker-meta strong {
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* 2026-05-14: nowrap so labels like "Not started · 19" / "No active
     pages" stay on one line. Without this they wrapped to two lines in
     narrow columns and pushed the row height to 64px while siblings
     stayed at 51px — the floating "Dixit" the user reported was the
     2nd line of "Ashwin Dixit" wrapping in the BDE column above a row
     that was tall because of the wrapping pill. */
  white-space: nowrap;
}

.status-pill.is-success {
  background: rgba(24, 119, 242, 0.12);
  color: var(--green-strong, #1877f2);
}

.status-pill.is-warn {
  background: rgba(196, 132, 0, 0.14);
  color: #8a5a00;
}

.status-pill.is-pending {
  background: rgba(196, 47, 47, 0.10);
  color: #a32424;
}

.status-pill.is-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.status-pill.is-green {
  background: rgba(24, 119, 242, 0.12);
  color: var(--green-strong, #1877f2);
}

.status-pill.is-red {
  background: rgba(196, 47, 47, 0.10);
  color: #a32424;
}

/* HR engine helpers ------------------------------------------------------- */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.link-button:hover strong {
  text-decoration: underline;
}

.onboarding-needs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.onboarding-needs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-2, #f5f5f5);
  border-radius: 8px;
}

.onboarding-tasks {
  display: grid;
  gap: 6px;
}

.onboarding-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2, #f5f5f5);
  border-radius: 8px;
  cursor: pointer;
}

.onboarding-task.is-done span {
  text-decoration: line-through;
  color: var(--muted, #888);
}

.hr-component-summary {
  list-style: disc;
  padding-left: 18px;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted, #666);
}

.hr-context-title {
  margin: 18px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
  color: var(--green-strong, #1877f2);
}

.hr-context-panel {
  background: var(--surface-2, #f5f7f5);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.hr-context-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hr-context-row.hr-context-stack {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}

.hr-context-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #777);
  min-width: 130px;
}

.hr-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hr-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(24, 119, 242, 0.08);
  color: var(--green-strong, #1877f2);
  font-size: 11px;
  font-weight: 600;
}

.hr-chip.hr-chip-more {
  background: var(--surface, #fff);
  color: var(--muted, #777);
  border: 1px dashed var(--line, #d8e0db);
}

.hr-doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.hr-doc-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface, #fff);
  border-radius: 8px;
  border: 1px solid var(--line, #e2e7e4);
}

.hr-doc-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hr-doc-name {
  word-break: break-all;
}

.hr-doc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hr-doc-upload-form {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line, #e2e7e4);
}

/* Employees dashboard cards ---------------------------------------------- */
.hr-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.hr-stat-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e2e7e4);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hr-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #6b7d72);
  font-weight: 600;
}

.hr-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-strong, #1877f2);
  line-height: 1.1;
}

.hr-stat-sub {
  font-size: 11px;
  color: var(--muted, #6b7d72);
}

.hr-stat-card.hr-stat-green { border-color: rgba(24, 119, 242, 0.3); }
.hr-stat-card.hr-stat-green .hr-stat-value { color: #1877f2; }
.hr-stat-card.hr-stat-amber { border-color: rgba(196, 132, 0, 0.35); background: #fff8eb; }
.hr-stat-card.hr-stat-amber .hr-stat-value { color: #8a5a00; }
.hr-stat-card.hr-stat-red { border-color: rgba(196, 47, 47, 0.3); background: #fdf3f3; }
.hr-stat-card.hr-stat-red .hr-stat-value { color: #a32424; }
.hr-stat-card.hr-stat-muted { background: var(--surface-2, #f5f7f5); }

.points-hero .points-hero-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.points-hero-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
}

.points-hero-main .muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.points-hero-number {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.points-hero-rupee {
  font-size: 16px;
  font-weight: 600;
  color: var(--green-strong, #1877f2);
}

.points-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 12px;
}

.points-hero-stats article {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.points-hero-stats article .muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.points-hero-stats article strong {
  font-size: 22px;
  font-weight: 700;
}

.points-ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}

.points-ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  gap: 12px;
}

.points-ledger-row:first-child {
  border-top: none;
}

.points-ledger-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-ledger-left strong {
  display: block;
  font-size: 15px;
}

.points-ledger-left span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.points-ledger-row.is-pos i {
  color: var(--green-strong, #1877f2);
}

.points-ledger-row.is-neg i {
  color: #a32424;
}

.recovery-banner {
  border-color: rgba(196, 47, 47, 0.3);
  background: rgba(196, 47, 47, 0.05);
}

.recovery-banner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.recovery-banner-row strong {
  display: block;
  font-size: 15px;
  color: #a32424;
}

.recovery-banner-row span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.snapshot-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snapshot-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-2);
}

.snapshot-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.snapshot-users {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.snapshot-users li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.tracker-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.tracker-date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.tracker-date-field span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tracker-date-field input[type="date"] {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
}

.tracker-totals-row {
  background: var(--green-soft, rgba(24, 119, 242, 0.08));
}

.tracker-totals-row td {
  border-top: 1px solid rgba(24, 119, 242, 0.2) !important;
  border-bottom: 1px solid rgba(24, 119, 242, 0.2) !important;
}

/* Show-wise daily/monthly matrix */
.row-today {
  background: rgba(240, 195, 107, 0.18);
}

.row-today td {
  font-weight: 600;
}

.row-totals {
  background: var(--green-soft, rgba(24, 119, 242, 0.08));
  position: sticky;
  top: calc(var(--topbar-h, 71px) + 33px);
  z-index: 2;
}

.row-totals td {
  border-top: 2px solid rgba(24, 119, 242, 0.35) !important;
  border-bottom: 2px solid rgba(24, 119, 242, 0.35) !important;
  background: var(--green-soft, rgba(24, 119, 242, 0.08));
}

.cell-dim {
  color: var(--subtle);
}

/* My Team page */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.team-card-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.team-card-identity strong {
  font-size: 15px;
}

.team-card-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 18px;
  font-weight: 700;
  color: var(--green-strong);
}

.team-card-amount small {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.team-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.team-card-stats strong {
  color: var(--text);
  margin-right: 4px;
}

.team-card-pages summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  padding: 4px 0;
}

.team-card-pages[open] summary {
  color: var(--text);
}

.team-card-pages .mini-list {
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
}

.team-card-plan {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-card-plan label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.team-card-plan textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  font: inherit;
  font-size: 13px;
  min-height: 70px;
  resize: vertical;
  background: var(--surface-2);
}

.team-card-plan textarea:focus {
  background: var(--surface);
  border-color: var(--green);
}

.team-card-plan textarea:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.team-card-tasks header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.team-card-tasks .mini-list {
  font-size: 12px;
}

.team-card-meetings header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.team-card-meetings .mini-list {
  font-size: 12px;
}

.team-card-meetings .mini-list a.text-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 4px 0;
}

.team-card-meetings .mini-list a.text-link strong {
  color: var(--text);
}

.team-card-meetings .mini-list a.text-link span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.inline-assign-select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  min-width: 140px;
}

.inline-assign-select:hover {
  border-color: var(--green-strong, #1877f2);
}

.dashboard-team-panel .section-title {
  margin-bottom: 8px;
}

.dashboard-leaders {
  margin-top: 16px;
}

.dashboard-leaders .muted {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.email-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-top: 4px;
  flex-wrap: wrap;
}

.email-status-row .muted {
  font-size: 12px;
}

.login-device-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.login-device-line i {
  width: 12px;
  height: 12px;
}

.points-adjust-cell {
  display: inline-flex;
  gap: 6px;
}

.points-adjust-cell button {
  padding: 4px 10px;
  font-size: 12px;
}

/* Audit module */

.audit-banner {
  border-left: 4px solid var(--green-strong, #1877f2);
}

.audit-banner.is-progress {
  border-left-color: #c47800;
  background: rgba(196, 132, 0, 0.06);
}

.audit-banner.is-due {
  border-left-color: var(--green-strong, #1877f2);
  background: rgba(24, 119, 242, 0.06);
}

.audit-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.audit-banner-row strong {
  display: block;
  font-size: 15px;
}

.audit-banner-row span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.audit-history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.audit-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.audit-history-row:first-child {
  border-top: none;
}

.audit-history-main strong {
  display: block;
  font-size: 14px;
}

.audit-history-main .muted {
  font-size: 12px;
}

.audit-history-actions {
  display: flex;
  gap: 6px;
}

.audit-trow-ok > td {
  background: rgba(24, 119, 242, 0.04);
}

.audit-trow-issue > td {
  background: rgba(196, 47, 47, 0.04);
}

.audit-action-stack {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.audit-action-stack button {
  padding: 4px 8px;
  font-size: 11px;
}

.audit-screenshot-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.audit-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.audit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.audit-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.audit-page-title strong {
  font-size: 14px;
}

.audit-flag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(196, 47, 47, 0.10);
  color: #a32424;
  border: 1px solid rgba(196, 47, 47, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.audit-flag-badge:hover {
  background: rgba(196, 47, 47, 0.18);
}

.audit-flag-badge i {
  width: 12px;
  height: 12px;
}

/* Per-row "Mark as healthy" button — green sibling of the red Log
   pill on the left side of each audit row. Same pill shape so the row
   reads as: red Log ──── green Mark as healthy. */
.audit-mark-healthy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(22, 163, 74, 0.10);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.30);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.audit-mark-healthy-btn:hover {
  background: rgba(22, 163, 74, 0.20);
  border-color: rgba(22, 163, 74, 0.45);
}

.audit-mark-healthy-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.audit-mark-healthy-btn i {
  width: 12px;
  height: 12px;
}

/* Static "Healthy" badge once the auditor has explicitly confirmed the
   row. Same green palette but solid-filled to read as "done" rather
   than "actionable". */
.audit-healthy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #15803d;
  color: #fff;
  border: 1px solid #166534;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.audit-healthy-badge i {
  width: 12px;
  height: 12px;
}

.audit-cp-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.audit-cp-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.audit-cp-pill.is-ok {
  background: rgba(24, 119, 242, 0.14);
  color: var(--green-strong, #1877f2);
}

.audit-cp-pill.is-bad {
  background: rgba(196, 47, 47, 0.12);
  color: #a32424;
}

.audit-cp-pill.is-pending {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--line);
}

.audit-cp-pill i {
  width: 10px;
  height: 10px;
}

.audit-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.audit-dashboard-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-dashboard-card.is-completed {
  border-color: rgba(24, 119, 242, 0.25);
  background: rgba(24, 119, 242, 0.04);
}

.audit-dashboard-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.audit-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.audit-dashboard-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-dashboard-stats .muted {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audit-dashboard-stats strong {
  font-size: 18px;
}

.audit-dashboard-card footer {
  display: flex;
  gap: 6px;
}

.audit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.audit-modal-header strong {
  display: block;
  font-size: 15px;
}

.audit-modal-header .muted {
  display: block;
  font-size: 12px;
}

.audit-cp-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
  background: var(--surface-2);
}

.audit-cp-block.is-ok {
  border-color: rgba(24, 119, 242, 0.3);
  background: rgba(24, 119, 242, 0.05);
}

.audit-cp-block.is-bad {
  border-color: rgba(196, 47, 47, 0.3);
  background: rgba(196, 47, 47, 0.04);
}

.audit-cp-block header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.audit-cp-toggle-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.audit-cp-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
}

.audit-cp-toggle:hover:not(:disabled) {
  border-color: var(--green-strong, #1877f2);
}

.audit-cp-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.audit-cp-toggle i {
  width: 12px;
  height: 12px;
}

.audit-cp-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audit-cp-status.is-ok { color: var(--green-strong, #1877f2); }
.audit-cp-status.is-bad { color: #a32424; }
.audit-cp-status.is-pending { color: var(--muted); }

.audit-prev-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-inline-select {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  padding: 4px 22px 4px 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  max-width: 160px;
}

.audit-inline-select.audit-status-ok {
  border-color: rgba(24, 119, 242, 0.45);
  background-color: rgba(24, 119, 242, 0.06);
  color: #1877f2;
  font-weight: 600;
}

.audit-inline-select.audit-status-bad {
  border-color: rgba(163, 36, 36, 0.45);
  background-color: rgba(163, 36, 36, 0.08);
  color: #a32424;
  font-weight: 600;
}

.audit-shot-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
}

.audit-shot-btn.has-shots {
  color: #1877f2;
  border-color: rgba(24, 119, 242, 0.45);
  background-color: rgba(24, 119, 242, 0.05);
  font-weight: 600;
}

.audit-shot-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.audit-inline-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background-color: var(--surface-2);
}

.audit-required-missing {
  border-color: rgba(163, 36, 36, 0.6) !important;
  background-color: rgba(163, 36, 36, 0.06) !important;
  box-shadow: 0 0 0 1px rgba(163, 36, 36, 0.25);
}

.audit-banner.is-frozen {
  border-left: 4px solid #999;
  background-color: rgba(120, 120, 120, 0.06);
}

.audit-flag-badge.has-prior {
  color: #a32424;
  border-color: rgba(163, 36, 36, 0.45);
  background-color: rgba(163, 36, 36, 0.06);
}

.audit-reason-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.audit-reason-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.audit-reason-row.muted {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0;
}

.audit-reason-row .ghost.small {
  padding: 2px 6px;
}

.audit-reason-form {
  display: flex;
  gap: 8px;
  max-width: 460px;
}

.audit-reason-form input {
  flex: 1;
}

.audit-history-log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-history-log li {
  padding: 4px 8px;
  border-left: 2px solid var(--line);
  background: var(--surface-2);
  border-radius: 4px;
}

.device-tag-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  min-width: 140px;
}

.device-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  max-width: 240px;
}

.device-tag .icon-button {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.device-tag-add {
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  background: transparent;
  color: var(--muted);
  max-width: 200px;
}

.device-tag-add:focus {
  outline: 2px solid rgba(24, 119, 242, 0.4);
  outline-offset: 1px;
}

.device-composite {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.device-composite-input {
  font-size: 12px;
  padding: 4px 6px;
}

/* cm-select inside table cells — make sure the popover floats above the
   row and the trigger fits the cell width without exploding the layout. */
.device-cm-select {
  min-width: 180px;
  max-width: 240px;
}

.device-cm-select .cm-trigger {
  font-size: 12px;
  padding: 4px 8px;
}

.device-cm-select .cm-popover {
  z-index: 30;
  min-width: 260px;
}

/* Trigger + search input inside Device Management — drop the heavy blue
   focus ring used in modals. Table cells already give enough framing. */
.device-cm-select.is-open .cm-trigger,
.device-cm-select .cm-trigger:focus,
.device-cm-select .cm-trigger:focus-visible {
  border-color: var(--line) !important;
  box-shadow: none !important;
  outline: none !important;
}

.device-cm-select .cm-search:focus,
.device-cm-select .cm-search:focus-visible {
  border-color: var(--line);
  box-shadow: none;
  outline: none;
}

.device-cm-select .cm-search-wrap:has(.cm-search:focus) {
  border-color: var(--line);
  box-shadow: none;
}

.muted.small {
  font-size: 12px;
}

.modal-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: center;
}

.modal-password-row input {
  min-width: 0;
}

.modal-password-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.modal-password-toggle:hover {
  border-color: var(--green-strong, #1877f2);
}

.user-username {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.user-password-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-password-mask,
.user-password-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.user-password-toggle,
.user-password-copy {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.user-password-toggle:hover,
.user-password-copy:hover {
  border-color: var(--green-strong, #1877f2);
}

.user-password-toggle i,
.user-password-copy i {
  width: 14px;
  height: 14px;
}

@media (max-width: 720px) {
  .upload-date-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }

  .upload-date-stats {
    width: 100%;
  }

  .upload-date-stat {
    flex: 1;
    text-align: center;
  }

  .upload-date-title {
    font-size: 19px;
  }

  .upload-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }

  .view-toggle {
    overflow-x: auto;
    width: 100%;
  }

  .view-toggle button {
    flex: 1;
    justify-content: center;
  }

  .upload-grid,
  .upload-grid.layout-grid,
  .upload-grid.layout-compact {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .upload-grid.layout-list .upload-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .upload-card {
    padding: 12px;
  }

  .upload-amount-input {
    font-size: 20px;
  }

  .upload-amount-submit {
    height: 40px;
    padding: 0 12px;
  }

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

  .portal-points-badge {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    text-align: left;
  }
}

.upload-amount-status {
  flex-basis: 100%;
}

.ocr-hint {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  padding: 2px 0;
}

.ocr-hint svg {
  height: 14px;
  width: 14px;
}

.ocr-hint.is-running {
  color: var(--muted);
}

.ocr-hint.is-running svg {
  animation: ocr-spin 1s linear infinite;
}

.ocr-hint.is-ok {
  color: var(--green-strong);
}

.ocr-hint.is-warn {
  color: var(--amber);
}

@keyframes ocr-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* Global loader spin utility — drop `.spin` on any element (typically a
   Lucide loader-2 icon) for a visible "this is in progress" affordance.
   Bulk-upload button, OCR triggers, async modal saves used loader-2
   without any animation; the silent freeze was a real UX complaint. */
.spin,
[data-spin],
i.spinning,
i[data-lucide="loader-2"].is-loading,
i[data-lucide="loader-2"].spin {
  animation: ocr-spin 1s linear infinite;
  transform-origin: center;
}
@media (prefers-reduced-motion: reduce) {
  .spin,
  [data-spin],
  i.spinning,
  i[data-lucide="loader-2"].is-loading,
  i[data-lucide="loader-2"].spin {
    animation-duration: 3s;
  }
}

.sidebar-logout {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  font-size: 13px;
  gap: 8px;
  height: 36px;
  justify-content: center;
}

.sidebar-logout:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.sidebar-logout svg {
  height: 16px;
  width: 16px;
}

/* Topbar */
.label,
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.main {
  min-width: 0;
  background: var(--bg);
}

.topbar {
  align-items: center;
  background: rgba(244, 246, 243, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.search-wrap {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 10px;
  max-width: 480px;
  min-width: 220px;
  padding: 0 12px;
  width: min(48vw, 480px);
}

.search-wrap svg {
  color: var(--subtle);
  width: 16px;
}

.search-wrap input {
  background: transparent;
  border: 0;
  height: 38px;
  min-width: 0;
  outline: 0;
  width: 100%;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 6px;
}

.logout-button {
  align-items: center;
  border-radius: var(--radius);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  min-width: 36px;
  padding: 0 10px;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.icon-button svg,
.action-row button svg,
.metric-title svg,
.section-title svg {
  height: 16px;
  width: 16px;
}

.file-button input {
  display: none;
}

.view {
  padding: 28px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Wide-table views (Page Performance, Show & Pages → Page Wise) get the
   full viewport. The default 1400px cap is too narrow for 15-column
   tables — users had to horizontally scroll inside an already-narrow box. */
.view.view--wide {
  max-width: none;
  padding-top: 16px;
  padding-bottom: 12px;
}
.view.view--wide .table-wrap {
  /* On wide-table views (Page Performance, Show & Pages), give the table
     even more vertical real estate — overview cards + page head only
     take ~80px when compact. */
  max-height: calc(100vh - 80px);
}

/* Page head */
.page-head {
  align-items: flex-end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-head h2 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  font-weight: 700;
}

.page-head p {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.build-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  cursor: pointer;
  background: rgba(34, 197, 94, 0.08);
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.25);
  white-space: nowrap;
}
.build-badge .build-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: build-pulse-fresh 2s infinite;
}
.build-badge.stale {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.3);
}
.build-badge.stale .build-dot {
  background: #f59e0b;
  animation: build-pulse-stale 1.2s infinite;
}
@keyframes build-pulse-fresh {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}
@keyframes build-pulse-stale {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.filter-chip {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid rgba(24, 119, 242, 0.35);
  border-radius: 999px;
  color: var(--green-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  /* 2026-05-14: nowrap so multi-word chip labels (e.g. "Vendor: Crime
     Petrol Dashmani") stay on one line and don't break out of the
     fixed 32px height. */
  white-space: nowrap;
}

.filter-chip:hover {
  background: rgba(24, 119, 242, 0.16);
}

.filter-chip svg {
  height: 14px;
  width: 14px;
}

/* Buttons */
.primary,
.secondary,
.danger,
.ghost {
  align-items: center;
  border-radius: var(--radius);
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  height: 36px;
  justify-content: center;
  padding: 0 14px;
  transition: background-color 120ms ease, border-color 120ms ease, transform 60ms ease;
}

.primary {
  background: var(--green);
  color: #fff;
}

.primary:hover {
  background: var(--green-strong);
}

.primary:active {
  transform: translateY(1px);
}

.secondary,
.ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.secondary:hover,
.ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.ghost {
  background: transparent;
}

.danger {
  background: #fff1f1;
  border: 1px solid #edb8b8;
  color: var(--red);
}

.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

/* Metric grid (Dashboard primary stats) */
.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 120ms ease;
}

.metric:hover {
  border-color: var(--line-strong);
}

.metric-title {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 10px 0 4px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

/* Overview band (kept for opt-in pages) */
.overview {
  margin-bottom: 18px;
}

.overview-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.overview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.overview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  display: block;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.overview-card.clickable {
  cursor: pointer;
  transition: border-color 120ms ease, transform 80ms ease, box-shadow 120ms ease, background 120ms ease;
}

.overview-card.clickable:hover {
  border-color: var(--green);
  box-shadow: 0 4px 14px rgba(24, 119, 242, 0.12);
  transform: translateY(-1px);
}

.overview-card.clickable:focus-visible {
  outline: 0;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}

.overview-card.clickable:active {
  transform: translateY(0);
}

.overview-card.active {
  background: var(--green-soft);
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(24, 119, 242, 0.25);
}

.overview-card.active strong {
  color: var(--green-strong);
}

/* 2026-05-14: drag-and-drop reorder for overview cards. */
.overview-card[draggable="true"] { cursor: grab; position: relative; }
.overview-card[draggable="true"]:active { cursor: grabbing; }
.overview-card.overview-dragging { opacity: 0.45; }
.overview-card.overview-drop-before {
  box-shadow: inset 3px 0 0 0 var(--green);
}
.overview-card.overview-drop-after {
  box-shadow: inset -3px 0 0 0 var(--green);
}
/* × remove button — top-right of every overview card. Visible on
   hover so it doesn't compete with the metric chrome at rest. */
.overview-card .overview-card-remove {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  color: var(--subtle);
  background: transparent;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}
.overview-card:hover .overview-card-remove,
.overview-card:focus-within .overview-card-remove {
  opacity: 1;
}
.overview-card .overview-card-remove:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

/* 2026-05-14: pivot table builder + saved pivot list */
/* Modal-panel sizing — pivot needs much more room than the default 720px. */
.modal-panel.modal-pivot {
  max-width: min(1400px, 95vw) !important;
  width: 95vw !important;
  max-height: 92vh !important;
  height: 92vh !important;
}
.modal-panel.modal-pivot-fullscreen {
  max-width: 100vw !important;
  width: 100vw !important;
  max-height: 100vh !important;
  height: 100vh !important;
  border-radius: 0 !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
}
/* The Customize Overview modal also benefits from a wider panel
   (it can show 35+ checkboxes and the 2-col grid was cramped). */
.modal-panel.modal-customize-overview {
  max-width: min(900px, 92vw);
  width: min(900px, 92vw);
}
/* Builder layout: controls on the left, live preview on the right.
   Both scroll independently within the modal body. */
.pivot-builder {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}
.pivot-builder-controls {
  display: flex; flex-direction: column; gap: 12px;
  overflow: auto;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}
.pivot-builder-preview-pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
}
.pivot-builder-meta { display: flex; flex-direction: column; gap: 8px; }
.pivot-builder-meta label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pivot-builder-meta input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-weight: normal; text-transform: none; letter-spacing: 0; color: var(--text); }
.pv-field-block { display: flex; flex-direction: column; gap: 6px; }
.pv-field-block > .pv-field-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pv-field-label .pv-field-count { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted); font-weight: 500; }
.pv-checks { border: 1px solid var(--border); border-radius: 6px; max-height: 180px; overflow: auto; background: var(--surface); }
.pv-checks label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.pv-checks label:last-child { border-bottom: 0; }
.pv-checks label:hover { background: var(--surface-2); }
.pv-checks input[type="checkbox"] { margin: 0; }
.pv-value-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.pv-value-row select, .pv-value-row input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.pv-value-row .pv-value-label { grid-column: 1 / -1; }
.pv-value-row .pv-value-remove { padding: 2px 8px; }
.pivot-builder-toolbar { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.pivot-builder-toolbar .pv-status { font-size: 12px; color: var(--muted); }
.pivot-preview-wrap { flex: 1; min-height: 200px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.pivot-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pivot-table th, .pivot-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
.pivot-table thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; font-weight: 600; border-bottom: 2px solid var(--border); }
.pivot-table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 2px solid var(--border); position: sticky; bottom: 0; }
.pivot-table tbody tr:hover { background: rgba(24, 119, 242, 0.04); }
.pivot-table tbody td:first-child { position: sticky; left: 0; background: var(--surface); border-right: 1px solid var(--border); z-index: 0; }
.pivot-table tfoot td:first-child { left: 0; z-index: 2; }
.pivot-modal-toolbar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 12px; gap: 4px;
}
.pivot-modal-toolbar-btn:hover { background: var(--surface-2); }
.pivot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pivot-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pivot-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pivot-card-head h3 { margin: 0; font-size: 14px; }
.pivot-card-actions { display: flex; gap: 4px; }
.pivot-card-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 4px 0 0; font-size: 12px; }
.pivot-card-meta dt { color: var(--muted); }
.pivot-card-meta dd { margin: 0; }

.overview-card strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 10px 0 4px;
}

.overview-card span {
  color: var(--muted);
  font-size: 12px;
}

.show-status-overview .overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.show-status-overview .overview-card {
  align-items: flex-start;
  display: grid;
  gap: 4px;
  position: relative;
  padding: 14px 14px 14px 18px;
}

.show-status-overview .overview-card::before {
  background: var(--line-strong);
  border-radius: 0 4px 4px 0;
  bottom: 14px;
  content: "";
  left: 6px;
  position: absolute;
  top: 14px;
  width: 3px;
}

.show-status-overview .overview-card[data-status="All"]::before { background: var(--ink); }
.show-status-overview .overview-card[data-status="Active"]::before { background: var(--green); }
.show-status-overview .overview-card[data-status="Acquisation Done"]::before { background: #1877f2; }
.show-status-overview .overview-card[data-status="Acquisation Pending"]::before { background: #c47a1c; }
.show-status-overview .overview-card[data-status="Branding pending"]::before { background: #b07d2c; }
.show-status-overview .overview-card[data-status="Whitelisting Pending"]::before { background: #6b6cd1; }
.show-status-overview .overview-card[data-status="Posting pending"]::before { background: #ce6e9d; }

.show-status-overview .overview-card strong {
  font-size: 24px;
  margin: 4px 0 2px;
}

.show-status-overview .overview-card span:first-of-type {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.show-status-overview .overview-card.active::before {
  background: var(--green-strong);
}

.show-status-overview .overview-card.is-empty {
  opacity: 0.55;
}

.show-status-overview .overview-card.is-empty:hover {
  opacity: 1;
}

.show-status-overview .overview-card.active.is-empty {
  opacity: 1;
}

.empty {
  align-content: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.empty p {
  margin: 0;
}

.empty .primary {
  margin-top: 6px;
}

/* Layout grids */
.content-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.75fr);
}

.ops-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 16px 16px;
}

.ops-block {
  min-width: 0;
}

a {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Charts */
.chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.chart-wrap {
  padding: 14px;
}

.chart-wrap svg {
  display: block;
  height: auto;
  max-height: 240px;
  width: 100%;
}

.chart-wrap rect {
  fill: var(--green);
}

.chart-wrap polyline {
  stroke: var(--green);
}

.chart-wrap circle {
  fill: #f0c36b;
  stroke: var(--green);
  stroke-width: 2px;
}

.chart-wrap text {
  fill: var(--muted);
  font-size: 11px;
}

/* Reports */
.report-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 14px;
}

.report-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 12px;
  position: relative;
}

.report-index {
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.report-card strong {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.report-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* No overflow — making the panel a scroll container would trap the
     sticky table <th> inside the panel and break its viewport-anchored
     positioning. Inner table-wraps handle horizontal scroll themselves. */
}

.panel-pad {
  padding: 16px;
}

.section-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
}

.section-title svg {
  color: var(--muted);
}

.section-title h3 {
  font-size: 14px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toolbar:last-child {
  margin-bottom: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-tools {
  align-items: center;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 8px 12px;
}

.table-tools [data-table-count] {
  margin-left: auto;
}

/* 2026-05-14 Phase 2 v2: dedicated drag-handle ⋮⋮ that's the sole
   drag source. Header content + sort-click + interactive children
   inside the <th> all stay fully clickable. */
table[data-table-id] th.col-dragging {
  opacity: 0.5;
  background: rgba(59, 130, 246, 0.08);
}
table[data-table-id] th.col-drop-target {
  box-shadow: inset 4px 0 0 var(--green-strong, #16a34a);
  background: rgba(22, 163, 74, 0.06);
}
table[data-table-id] .col-drag-handle {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--muted, #9ca3af);
  cursor: grab;
  user-select: none;
  font-size: 12px;
  line-height: 1;
  letter-spacing: -2px;
  vertical-align: middle;
  font-weight: 700;
  /* Stay above any flex/grid layout of header content so the handle
     never gets pushed onto a separate visual line. */
  flex: 0 0 auto;
}
table[data-table-id] .col-drag-handle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text, #111827);
}
table[data-table-id] .col-drag-handle:active {
  cursor: grabbing;
}

/* 2026-05-15: Column resize. Thin grabber on the right edge of each <th>
   that lets the user widen/narrow the column. <th> is already
   `position: sticky` (frozen header), which itself creates a containing
   block for absolute-positioned children, so the resizer anchors to the
   th without needing an explicit `position: relative` override (which
   would break the freeze — sticky vs relative are mutually exclusive). */
table[data-table-id] th > .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 4;
  background: transparent;
  transition: background-color 120ms ease-out;
}
table[data-table-id] th > .col-resizer:hover,
table[data-table-id] th.col-resizing > .col-resizer {
  background: rgba(59, 130, 246, 0.35);
}
table[data-table-id] th.col-resizing {
  background: rgba(59, 130, 246, 0.06);
}

/* 2026-05-15: Column-visibility modal row layout. Each row carries a
   ⋮⋮ drag handle, ↑/↓ arrow buttons, and the show/hide checkbox so the
   user can both reorder + toggle visibility from one screen. */
.cv-list { display: flex; flex-direction: column; gap: 4px; }
.cv-row {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  transition: background-color 120ms ease-out, transform 120ms ease-out;
}
.cv-row.is-unnamed { opacity: 0.5; }
.cv-row.is-dragging { opacity: 0.4; }
.cv-row.is-drop-target {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--green-strong, #16a34a);
}
.cv-handle {
  color: var(--muted, #9ca3af);
  cursor: grab;
  font-size: 14px;
  letter-spacing: -2px;
  padding: 2px 4px;
  user-select: none;
}
.cv-handle:active { cursor: grabbing; }
.cv-arrow {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  height: 24px;
  line-height: 1;
  padding: 0 6px;
}
.cv-arrow:hover:not(:disabled) { background: var(--surface-3); }
.cv-arrow:disabled { cursor: not-allowed; opacity: 0.4; }
.cv-toggle {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex: 1;
  font-size: 13px;
  gap: 8px;
}
.cv-toggle input[type="checkbox"]:disabled { cursor: not-allowed; }

/* 2026-05-15: Subtle totals strip inserted just above each table.
   Auto-detects numeric columns from visible rows and shows Σ chips per
   column. Recalculates on every applyTableState run so filter / search /
   pagination changes are reflected. Less prominent than overview cards. */
.table-totals {
  align-items: center;
  background: var(--surface-2);
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 6px;
  padding: 6px 12px;
}
.table-totals .table-totals-prefix {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}
.table-totals .table-totals-chip {
  align-items: baseline;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  gap: 6px;
  padding: 2px 10px;
}
.table-totals .ttl-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}
.table-totals .ttl-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* 2026-05-15: Table Master status pill (Standard / Bypass). */
.tm-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tm-pill.is-ok { background: rgba(22, 163, 74, 0.12); color: #15803d; }
.tm-pill.is-warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }

/* 2026-05-14 universal table affordances */
.table-tools .table-clear-filters {
  color: var(--red, #dc2626);
  border-color: rgba(220, 38, 38, 0.25);
}
.table-tools .table-clear-filters:hover {
  background: rgba(220, 38, 38, 0.08);
}
.table-tools .table-view-picker {
  height: 32px;
  font-size: 12px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}
.table-tools .table-views-manage {
  padding: 4px 6px;
}

.table-search {
  max-width: 320px;
  width: min(40vw, 320px);
}

.table-search input {
  height: 32px;
  font-size: 12px;
}

.field,
.field-inline {
  display: grid;
  gap: 6px;
}

.field-inline {
  align-items: center;
  grid-template-columns: auto minmax(120px, 1fr);
}

.field label,
.field-inline label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
input,
textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  outline: 0;
  font-size: 13px;
}

select,
input {
  height: 36px;
  padding: 0 10px;
}

select[multiple] {
  height: auto;
  min-height: 132px;
  padding: 8px;
}

.multi-select-search {
  margin-bottom: 8px;
  width: 100%;
}

.multi-select-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.multi-select-toolbar .small {
  height: 26px;
  padding: 0 8px;
}

.multi-select-toolbar .multi-select-count {
  font-size: 12px;
  margin-left: auto;
}

.cm-select {
  position: relative;
}

.cm-hidden-select {
  height: 0 !important;
  left: 0;
  min-height: 0 !important;
  opacity: 0;
  padding: 0 !important;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 1px;
}

.cm-trigger {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

.cm-trigger:hover {
  border-color: var(--line-strong);
}

.cm-select.is-open .cm-trigger {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
}

.cm-summary {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
}

.cm-placeholder {
  color: var(--muted);
}

.cm-chip {
  align-items: center;
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green-strong);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
}

.cm-chip-more {
  background: var(--surface-3);
  color: var(--ink);
}

.cm-caret {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 120ms ease;
}

.cm-select.is-open .cm-caret {
  transform: rotate(180deg);
}

.cm-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 0;
  margin-top: 4px;
  max-height: 360px;
  padding: 10px;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
}

.cm-popover[hidden] {
  display: none;
}

.cm-search-wrap {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 8px;
  padding: 0 10px;
}

.cm-search-wrap svg {
  color: var(--muted);
  flex-shrink: 0;
  height: 14px;
  width: 14px;
}

.cm-search {
  background: transparent;
  border: 0;
  flex: 1;
  font-size: 13px;
  height: 32px;
  padding: 0;
}

.cm-search:focus {
  outline: 0;
}

.cm-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cm-toolbar .small {
  height: 26px;
  padding: 0 8px;
  white-space: nowrap;
}

.cm-toolbar .cm-count {
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
}

.cm-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  /* 2026-05-14: doubled from 220px so the Page Names picker shows
     ~14 rows at once instead of ~7. The Page-Names picker for a
     Page User can have 8-30 options after show filter — at 220px
     the admin had to scroll inside the dropdown which scrolled
     inside the modal which scrolled the page. Single scroll now. */
  max-height: min(440px, 50vh);
  padding-right: 2px;
}

.cm-options .cm-option {
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
  letter-spacing: normal;
  padding: 6px 8px;
  text-transform: none;
  transition: background-color 100ms ease;
}

.cm-options .cm-option:hover {
  background: var(--surface-2);
}

/* The browser's [hidden] { display: none } default loses against the
   `display: flex` rule above (same specificity, author rule wins).
   Without this, the search filter sets the hidden attribute but the
   options stay visible. Bug seen on the Device Management table. */
.cm-options .cm-option[hidden] {
  display: none;
}

.cm-options .cm-option input[type="checkbox"] {
  height: 16px;
  margin: 0;
  width: 16px;
}

.cm-options .cm-option span {
  flex: 1;
}

.cm-empty {
  font-size: 12px;
  padding: 12px 8px;
  text-align: center;
}

.show-bulk-bar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  transition: background-color 120ms ease;
}

.show-bulk-bar.is-active {
  background: var(--green-soft);
}

.show-bulk-bar .bulk-count {
  font-size: 12px;
  font-weight: 600;
}

.show-bulk-bar .bulk-spacer {
  flex: 1;
}

.show-bulk-bar button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.row-select-cell {
  text-align: center;
  width: 36px;
}

.row-select-cell input[type="checkbox"] {
  cursor: pointer;
}

tr.row-selected > td {
  background: var(--green-soft);
}

tr.row-archived > td {
  background: var(--surface-3);
  opacity: 0.65;
}

.show-name-multiline {
  display: inline-block;
  line-height: 1.4;
  white-space: pre-wrap;
}

.dual-overview-panel {
  margin-bottom: 18px;
  padding: 16px;
}

.dual-overview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dual-overview-section {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.dual-overview-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  letter-spacing: 0.02em;
  padding-bottom: 8px;
}

.dual-overview-head svg {
  color: var(--green);
  height: 16px;
  width: 16px;
}

.dual-overview-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.dual-overview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
}

.dual-overview-card.accent-green {
  border-color: rgba(24, 119, 242, 0.35);
}

.dual-overview-card.accent-green .dual-overview-value {
  color: var(--green-strong);
}

.dual-overview-card.accent-amber {
  border-color: #e7c388;
  background: #fff7ea;
}

.dual-overview-card.accent-amber .dual-overview-value {
  color: var(--amber);
}

.dual-overview-card.accent-red {
  border-color: #edb8b8;
  background: #fff1f1;
}

.dual-overview-card.accent-red .dual-overview-value {
  color: var(--red);
}

.dual-overview-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dual-overview-value {
  font-size: 22px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .dual-overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

select[multiple] option {
  border-radius: 6px;
  padding: 6px 8px;
}

textarea {
  min-height: 96px;
  padding: 10px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.12);
}

/* Tables */
.table-wrap {
  overflow: auto;
  max-width: 100%;
  /* Use most of the viewport — header + page-head + filters take ~120px,
     leave the rest for table rows so users see as many rows as their
     screen allows without scrolling the outer page. */
  max-height: calc(100vh - 120px);
}

/* Show-all toggle that lives directly under every paginated table.
   Universal — applied automatically by applyTableState whenever the
   matched-row count exceeds TABLE_DEFAULT_PAGE_SIZE. */
.table-show-all-btn {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
  margin: 12px 16px 16px;
  padding: 8px 14px;
  transition: background-color 120ms ease-out;
}
.table-show-all-btn:hover { background: var(--surface-3); }
.table-show-all-btn svg { width: 14px; height: 14px; }

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
}

/* 2026-05-14 — Per-table density toggle. data-density="compact" packs
   ~50% more rows on screen with smaller text + tighter padding;
   "spacious" uses larger text + roomy padding for readability. The
   default (no attribute, or "normal") keeps the historical sizing. */
table[data-table-id][data-density="compact"] th,
table[data-table-id][data-density="compact"] td {
  padding: 4px 8px;
  font-size: 12px;
}
table[data-table-id][data-density="compact"] th {
  font-size: 10px;
}
table[data-table-id][data-density="spacious"] th,
table[data-table-id][data-density="spacious"] td {
  padding: 14px 18px;
  font-size: 15px;
}
table[data-table-id][data-density="spacious"] th {
  font-size: 12px;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 3;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--green);
}

.sheet-filter-row th {
  background: var(--surface-2);
  padding: 6px 10px;
  top: 32px;
  z-index: 2;
}

.column-filter-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
  height: 28px;
  justify-content: flex-start;
  padding: 0 8px;
  width: 100%;
}

.column-filter-toggle:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.column-filter-toggle.is-active {
  background: var(--green-soft);
  border-color: rgba(24, 119, 242, 0.35);
  color: var(--green-strong);
}

.column-filter-toggle svg {
  height: 12px;
  width: 12px;
}

.column-filter-label {
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-filter-badge {
  background: var(--green);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  padding: 1px 6px;
  text-align: center;
}

.column-filter-modal {
  display: grid;
  gap: 10px;
}

.column-filter-search {
  height: 36px;
}

.column-filter-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
}

.column-filter-toolbar .muted {
  margin-left: auto;
}

.column-filter-options {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.column-filter-option {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 6px 8px;
}

.column-filter-option:hover {
  background: var(--surface);
}

.column-filter-option input {
  height: 14px;
  margin: 0;
  width: 14px;
}

.column-filter-option span {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th[data-sort-direction="asc"]::after {
  content: " ↑";
}

th[data-sort-direction="desc"]::after {
  content: " ↓";
}

td {
  font-size: 13px;
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.link-count,
.text-link {
  background: transparent;
  color: var(--green);
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.link-count {
  align-items: center;
  background: var(--green-soft);
  border-radius: 999px;
  display: inline-flex;
  justify-content: center;
  min-width: 30px;
  padding: 3px 9px;
  font-size: 12px;
}

.link-count:hover,
.text-link:hover {
  color: var(--green-strong);
  text-decoration: underline;
}

.cell-main {
  display: grid;
  gap: 2px;
  /* 2026-05-14: cap width + force ellipsis on every stacked line so
     long secondary text (page name lists, IP+device strings, multi-
     show lists) truncates instead of wrapping to 3+ lines. Combined
     with the children rules below, this collapses uneven 70-120px
     rows down to a uniform ~40-48px across every table that uses
     the stacked-cell pattern (Users, Master Data, Payouts, etc.).
     min-width: 0 is required for grid children to shrink past their
     intrinsic content size and respect ellipsis. */
  min-width: 0;
  max-width: 260px;
}
.cell-main > strong,
.cell-main > span,
.cell-main > em,
.cell-main > div,
.cell-main > code {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rate-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rate-locked .ghost.small {
  padding: 2px 4px;
}
.invoice-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.invoice-upload {
  display: inline-block;
  cursor: pointer;
}
.invoice-upload .ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}
.invoice-upload:hover .ghost {
  color: var(--text);
}

.cell-main em {
  color: var(--amber);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.cell-main strong {
  font-size: 13px;
  font-weight: 600;
}

.cell-main span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

td .muted {
  display: block;
  line-height: 1.3;
  margin-top: 2px;
}

.name-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 280px;
}

.name-stack span {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
}

.page-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.page-chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
}

.bank-open {
  font-size: 13px;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 5px 9px;
}

.status-select {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 30px;
  min-width: 138px;
  padding: 0 28px 0 10px;
}

.inline-number {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: text;
  font-size: 13px;
  font-weight: 600;
  height: 30px;
  padding: 0 8px;
  text-align: right;
  width: 78px;
}

.cell-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  height: 30px;
  padding: 0 8px;
  width: 100%;
}

.cell-input:hover,
.cell-input:focus {
  background: var(--surface);
  border-color: var(--line);
  outline: none;
}

.cell-input-strong {
  font-weight: 700;
}

.cell-input-num {
  text-align: right;
  width: 80px;
}

.cell-select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  height: 30px;
  min-width: 110px;
  padding: 0 26px 0 10px;
}

.cell-select:focus {
  border-color: var(--green);
  outline: none;
}

/* Merged Device Management table — auto-size columns to content so the
   admin / FB-ID columns don't truncate. The wrapper scrolls horizontally
   if the merged content exceeds the viewport. */
[data-table-id="merged-device-table"] {
  table-layout: auto !important;
  width: max-content;
  min-width: 100%;
}

[data-table-id="merged-device-table"] th,
[data-table-id="merged-device-table"] td {
  vertical-align: top;
  white-space: nowrap;
}

[data-table-id="merged-device-table"] .cell-input,
[data-table-id="merged-device-table"] .cell-select {
  width: auto;
  min-width: 120px;
}

.fb-chip-stack {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.fb-chip {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
  padding: 6px 10px;
}

.fb-chip-link {
  align-items: center;
  color: var(--green-strong);
  display: inline-flex;
  font-weight: 700;
  gap: 6px;
  text-decoration: none;
}

.fb-chip-link:hover {
  text-decoration: underline;
}

.fb-chip-link i {
  height: 12px;
  width: 12px;
}

.fb-chip-name {
  font-weight: 700;
}

.fb-chip-id {
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}

.fb-chip .icon-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 22px;
  padding: 0;
  width: 22px;
}

.fb-chip .icon-button:hover {
  color: var(--text);
}

.fb-chip-add {
  align-self: flex-start;
}

.cell-derived {
  color: var(--muted);
  font-style: italic;
}

.fb-chip-tag {
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
}

.fb-chip-tag-first-access {
  background: rgba(24, 119, 242, 0.18);
  color: var(--green-strong);
}

.fb-chip-tag-second-access {
  background: rgba(58, 138, 230, 0.18);
  color: #2155a8;
}

.fb-chip-tag-backup-access {
  background: rgba(245, 158, 11, 0.22);
  color: #92400e;
}

.fb-chip-tag-select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  height: 24px;
  padding: 0 22px 0 8px;
}

.fb-chip-tag-select:focus {
  border-color: var(--green);
  outline: none;
}

.inline-number:focus,
.inline-number:hover {
  border-color: var(--green);
}

.show-pages-list {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.show-pages-list li {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.status.Active,
.status-select.Active,
.status.Internal,
.status.Done,
.status.Paid,
.status.Generated,
.status.AcquisationDone,
.status.Approved,
.status.Audited,
.status-select.AcquisationDone {
  background: var(--green-soft);
  color: #135536;
}

.status.Disbursed {
  background: #e9efff;
  color: #2c4a96;
}

.status.OnHold {
  background: #ececec;
  color: #4a4a4a;
}

.status.External {
  background: #e9efff;
  color: #3152a3;
}

.status.Cooling,
.status.Pending,
.status.Draft,
.status.DueSoon,
.status.Requested,
.status.AcquisationPending,
.status.Brandingpending,
.status.WhitelistingPending,
.status.Postingpending,
.status-select.AcquisationPending,
.status-select.Brandingpending,
.status-select.WhitelistingPending,
.status-select.Postingpending {
  background: #fff0d8;
  color: #7d4a0e;
}

.status.Disabled,
.status.Deleted,
.status.Overdue,
.status.Rejected {
  background: #ffe1e1;
  color: #8e2929;
}

.action-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.action-row button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  min-width: 28px;
}

.action-row button:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.action-row button svg {
  height: 14px;
  width: 14px;
}

/* Lists */
.mini-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.mini-list li {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  list-style: none;
  padding: 10px 12px;
}

.mini-list li strong {
  font-size: 13px;
  font-weight: 600;
}

.mini-list li span {
  color: var(--muted);
  font-size: 12px;
}

/* Tabs */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: var(--radius);
}

.tabs button {
  background: transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  height: 30px;
  padding: 0 12px;
}

.tabs button:hover {
  color: var(--text);
}

.tabs button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Portal & uploads */
.portal-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
}

.invoice-upload {
  display: grid;
  gap: 14px;
}

.upload-zone {
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 156px;
  padding: 20px;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
}

.upload-zone:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-zone svg {
  color: var(--green);
  height: 26px;
  width: 26px;
}

.upload-zone span,
.helper-text {
  color: var(--muted);
  font-size: 12px;
}

.upload-zone input {
  display: none;
}

.invoice-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.parsed-invoice {
  border-color: #b9d8c7;
}

.vendor-profile {
  display: grid;
  gap: 10px;
}

.profile-row {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
}

.profile-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.raw-grid {
  max-height: calc(100vh - 240px);
  overflow: auto;
}

.raw-grid table {
  min-width: 900px;
}

.upload-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 360px);
  margin-bottom: 16px;
}

.upload-card {
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 156px;
  padding: 22px;
  text-align: center;
}

.upload-card:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.upload-card input[type="file"] {
  display: none;
}

.upload-card span,
.comparison-band span {
  color: var(--muted);
}

.screenshot-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 220px;
  object-fit: contain;
  width: 100%;
}

.comparison-band {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.comparison-band article {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 14px;
}

.empty {
  color: var(--muted);
  padding: 36px 28px;
  text-align: center;
  font-size: 13px;
}

/* Modal */
.modal {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 20;
}

.modal[aria-hidden="false"] {
  display: block;
}

.modal-backdrop {
  background: rgba(27, 34, 28, 0.45);
  inset: 0;
  position: absolute;
  backdrop-filter: blur(2px);
}

.modal-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  left: 50%;
  /* 2026-05-14 (Nikhil): default size bumped + user-resizable.
     - Wider default (920) so the Page Names picker has breathing room
     - Resize handle in the bottom-right corner (CSS native resize)
     - min sizes keep the modal usable when shrunk
     - max sizes cap at viewport so it never overflows
     The browser's resize: both requires `overflow: auto` on the same
     element; we keep the inner modal-body scrolled instead (grid row
     2 is minmax(0, 1fr)) so the chrome stays put. */
  max-height: calc(100vh - 32px);
  max-width: calc(100vw - 32px);
  min-height: 240px;
  min-width: 360px;
  position: absolute;
  resize: both;
  overflow: hidden;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 40px));
}

/* 2026-05-14: visible affordance for the resize handle (corner glyph). */
.modal-panel::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 50%, var(--muted, #9ca3af) 50%, var(--muted, #9ca3af) 60%, transparent 60%, transparent 70%, var(--muted, #9ca3af) 70%, var(--muted, #9ca3af) 80%, transparent 80%);
  opacity: 0.55;
}

.modal-header,
.modal-footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 20px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  background: var(--surface-2);
}

.modal-body {
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full {
  grid-column: 1 / -1;
}

.check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-card {
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 10px 12px;
  transition: border-color 120ms ease;
}

.check-card:hover {
  border-color: var(--line-strong);
}

.check-card input {
  height: 16px;
  margin-top: 2px;
}

.check-card strong,
.check-card small {
  display: block;
}

.check-card strong {
  font-size: 13px;
  font-weight: 600;
}

.check-card small {
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
}

/* Toast */
.toast {
  background: var(--ink);
  border-radius: var(--radius);
  bottom: 20px;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  left: 50%;
  max-width: min(520px, calc(100vw - 32px));
  opacity: 0;
  padding: 11px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive */
@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .brand {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 4px 0 14px;
  }

  .brand div:last-child,
  .nav button span:not(.count-pill),
  .nav .nav-section,
  .nav button .count-pill,
  .sidebar-card,
  .sidebar-logout span {
    display: none;
  }

  .sidebar-logout {
    min-height: 36px;
    padding: 0;
  }

  .nav button {
    grid-template-columns: 1fr;
    justify-items: center;
  }

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

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

  .content-grid,
  .ops-grid,
  .portal-grid,
  .invoice-summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

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

  .upload-grid,
  .comparison-band {
    grid-template-columns: 1fr;
  }

  .view {
    padding: 22px 18px;
  }
}

@media (max-width: 720px) {
  .shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    height: auto;
    overflow-x: auto;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    position: static;
  }

  .brand,
  .sidebar-card,
  .sidebar-logout span,
  .nav .nav-section {
    display: none;
  }

  .nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    flex: 0 0 auto;
    grid-template-columns: 18px;
    justify-items: center;
    /* WCAG 2.5.5 (and Apple HIG) require 44x44 minimum touch targets on
       mobile. PWA installs run on iOS so this lands as a real tap-target. */
    height: 44px;
    min-width: 44px;
    padding: 0 10px;
  }

  .nav button span:not(.count-pill) {
    display: none;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .search-wrap {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .passkey-setup-button span {
    display: none;
  }

  .view {
    padding: 16px max(14px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .overview-grid,
  .check-grid,
  .report-grid,
  .upload-grid,
  .comparison-band {
    grid-template-columns: 1fr;
  }

  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .table-search {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (display-mode: standalone) {
  body {
    user-select: none;
  }

  input,
  textarea {
    user-select: text;
  }
}

.pf-timeline {
  display: grid;
  gap: 16px;
}

.pf-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.pf-meta > div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  padding: 10px 12px;
}

.pf-meta span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pf-meta strong {
  font-size: 13px;
}

.pf-purpose {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.pf-purpose span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.pf-purpose p {
  margin: 0;
  white-space: pre-wrap;
}

.pf-history {
  border-left: 2px solid var(--line);
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
}

.pf-history li {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  padding: 8px 12px;
  position: relative;
}

.pf-history li::before {
  background: var(--accent, #2c4a96);
  border-radius: 50%;
  content: "";
  height: 8px;
  left: -21px;
  position: absolute;
  top: 14px;
  width: 8px;
}

.pf-history strong {
  font-size: 13px;
}

.pf-history span {
  color: var(--muted);
  font-size: 12px;
}

.pf-history p {
  margin: 0;
  white-space: pre-wrap;
}

/* Page Performance — logo + intro cells */
.pp-logo-cell { width: 56px; padding-right: 0; }
.pp-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: block;
}
.pp-logo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}
/* Page Performance — source badge inline next to page name */
.pp-source {
  display: inline-block;
  margin-left: .4rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  vertical-align: 2px;
  border: 1px solid transparent;
}
.pp-source-cfai      { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.pp-source-extension { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.pp-source-manual    { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
/* Show & Pages — small avatar variant inside the Page Name cell */
.pp-logo-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.page-name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.page-name-cell-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.page-name-followers {
  font-size: 0.72rem;
  margin-top: 1px;
}
.pp-intro {
  max-width: 320px;
  white-space: normal;
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.35;
}
.pp-bulk-bar {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
table[data-table-id="page-performance-table"] tr.row-selected td {
  background: #eff6ff;
}
table[data-table-id="page-performance-table"] th:first-child,
table[data-table-id="page-performance-table"] td:first-child {
  width: 32px;
  text-align: center;
  padding-left: 0.75rem;
  padding-right: 0;
}
table[data-table-id="page-performance-table"] input[type="checkbox"] {
  cursor: pointer;
}
/* Freeze the header — sticks to the top of the page-scroll container as
   you scroll the long Page Performance list. */
table[data-table-id="page-performance-table"] thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 4;
  box-shadow: inset 0 -1px 0 #e2e8f0;
}
/* Overview cards above the Page Performance table */
.pp-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.pp-overview-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.pp-overview-label {
  font-size: 0.78rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.pp-overview-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
.pp-overview-value--warn { color: #b45309; }
.pp-overview-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.25rem;
}
.pp-overview-card--action {
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
.pp-overview-card--action:hover {
  border-color: #f59e0b;
  transform: translateY(-1px);
}
/* Activity log table */
.pp-log-error {
  max-width: 240px;
  white-space: normal;
  font-size: 0.78rem;
  color: #b91c1c;
  line-height: 1.3;
}
.pp-log-ok { color: #15803d; font-weight: 600; }

/* Page Performance — Facebook-style detail page. Logo is absolute-
   positioned over the cover so it always sits on top of the banner
   regardless of flex math or stacking context. */
.pp-detail { overflow: visible; position: relative; }
.pp-detail-cover {
  height: 320px;
  background: linear-gradient(135deg, #1877f2 0%, #4267B2 100%);
  background-size: cover;
  background-position: center;
  position: relative;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  z-index: 1;
}
.pp-detail-cover-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.5rem;
  color: #fff;
  background: rgba(0,0,0,0.15);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.pp-detail-cover-empty i { width: 48px; height: 48px; }
.pp-detail-head {
  position: relative;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.25rem 2rem 1.5rem 14rem;  /* left padding leaves room for absolute logo */
  min-height: 96px;                    /* keep meta below the logo's lower half */
  z-index: 2;
}
.pp-detail-logo {
  position: absolute;
  left: 2rem;
  top: -84px;                          /* half of logo height (168/2) overlaps the cover */
  width: 168px; height: 168px;
  border-radius: 50%;
  border: 6px solid #fff;
  background: #f1f5f9;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 3;                          /* above cover (1) and head (2) */
}
.pp-detail-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pp-detail-logo-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0;
  border: 0;
}
.pp-detail-logo-placeholder i { width: 64px; height: 64px; color: #94a3b8; }
.pp-detail-meta {
  flex: 1;
  padding-top: 0.5rem;
}
.pp-detail-meta h2 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  line-height: 1.1;
  color: #0f172a;
}
.pp-detail-sub {
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.25rem;
}
.pp-detail-intro {
  margin: 0 2rem 1.5rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.pp-detail-intro i { color: #64748b; flex-shrink: 0; margin-top: 2px; }
.pp-detail-intro p { margin: 0; color: #334155; line-height: 1.5; }
.pp-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 0 2rem 1.5rem;
}
.pp-stat {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
}
.pp-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}
.pp-stat-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pp-detail-insights {
  margin: 0 2rem 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.pp-detail-section {
  margin: 1.5rem 2rem 0;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.pp-detail-section .section-title { margin-bottom: .75rem; }
.pp-detail-monthly { margin-top: .75rem; }
.pp-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.pp-detail-table thead th {
  background: #f8fafc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.pp-detail-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}
.pp-detail-table tbody tr:last-child td { border-bottom: 0; }
.pp-detail-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pp-stat-value small { font-size: 11px; font-weight: 400; color: #64748b; margin-left: 4px; }
@media (max-width: 720px) {
  .pp-detail-cover { height: 200px; }
  .pp-detail-head { flex-direction: column; align-items: center; text-align: center; padding: 4.5rem 1rem 1rem; min-height: 0; }
  .pp-detail-logo { width: 128px; height: 128px; left: 50%; transform: translateX(-50%); top: -64px; }
  .pp-detail-meta { padding-top: 0; }
  .pp-detail-intro, .pp-stat-grid, .pp-detail-insights, .pp-detail-section { margin-left: 1rem; margin-right: 1rem; }
}

/* Multi-role chips in the Users table */
.role-chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 2px 1px 0;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  background: #eef2ff;
  color: #3730a3;
  white-space: nowrap;
}

/* Capitalise every user-display name to enforce "first letter capital"
   across the app — applied wherever a user name surfaces in tables /
   modals / cells. CSS `capitalize` only ever uppercases the FIRST letter
   of each word, leaving the rest intact, so existing all-caps names
   stay as-is and lowercase-stored names like "divya" render as "Divya". */
.user-name,
[data-user-name],
.cell-user {
  text-transform: capitalize;
}

/* Sort indicator arrows on table headers — shown when applyTableState sets
   data-sort-direction. Pure CSS so no JS-render hop is needed. */
.table-wrap th[data-sort-direction] {
  position: relative;
  padding-right: 22px;
}
.table-wrap th[data-sort-direction]::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  transform: translateY(-50%);
  opacity: 0.7;
}
.table-wrap th[data-sort-direction="asc"]::after  { border-bottom: 5px solid currentColor; }
.table-wrap th[data-sort-direction="desc"]::after { border-top:    5px solid currentColor; }

/* Bigger tab hit area for fat-finger taps on mobile + better focus ring
   for keyboard nav. Master Data subtab strip uses .tabs button. */
.tabs button {
  min-height: 36px;
  padding: 8px 14px;
}
.tabs button:focus-visible {
  outline: 2px solid var(--primary, #1877f2);
  outline-offset: 2px;
}

/* Scroll-shadow indicator on tables that overflow their container. The
   inset shadow on the right edge gives a "more columns this way →" cue
   without adding markup. Tables that fit fully don't trigger it because
   the shadow is clipped by overflow:hidden on the wrap. */
.table-wrap {
  background:
    linear-gradient(to right, var(--surface, #fff), var(--surface, #fff)) left center / 16px 100% no-repeat,
    linear-gradient(to right, rgba(0,0,0,0.08), rgba(0,0,0,0)) left center / 8px 100% no-repeat,
    linear-gradient(to right, var(--surface, #fff), var(--surface, #fff)) right center / 16px 100% no-repeat,
    linear-gradient(to left,  rgba(0,0,0,0.08), rgba(0,0,0,0)) right center / 8px 100% no-repeat;
  background-attachment: local, scroll, local, scroll;
}

/* Mobile modal viewport — shrinks padding + lets long tables in modal
   bodies use the full screen instead of being clipped at ~80vw. */
@media (max-width: 600px) {
  .modal-panel {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    margin: 4vh auto;
  }
  .modal-body {
    padding: 12px;
  }
}

/* Status badge icon — for status pills/cells, prepend a coloured dot so
   the cue isn't colour-only (passes simple colour-blindness review). */
[data-status]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
  opacity: 0.7;
}

/* Brain Team Management — hierarchy cards */
.bt-btm-panel { margin-bottom: 14px; }
.bt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.bt-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}
.bt-card-title strong { font-size: 16px; }
.bt-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bt-role-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.bt-role-btm { background: #dcfce7; color: #14532d; }
.bt-role-bte { background: #dbeafe; color: #1e3a8a; }
.bt-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bt-card-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: start;
  padding: 6px 0;
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
}
.bt-card-row:first-child { border-top: 0; }
.bt-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 13px;
  align-items: center;
}
.bt-show-chip {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: #1f2937;
  white-space: nowrap;
}
.bt-team-chip {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: #713f12;
  white-space: nowrap;
}
.bt-children {
  margin-top: 12px;
  margin-left: 22px;
  border-left: 2px solid #e5e7eb;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bt-bte-card {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
}
.bt-empty-children {
  background: transparent;
  border: 0;
  padding: 6px 0;
  font-size: 13px;
}
@media (max-width: 720px) {
  .bt-card-row { grid-template-columns: 1fr; gap: 4px; }
  .bt-children { margin-left: 8px; padding-left: 8px; }
}

/* Assignment admin overview — per-BTE cards + collapsible shows */
.asg-bt-panel { margin-bottom: 14px; }
.asg-bt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.asg-bt-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  flex-wrap: wrap;
}
.asg-bt-title strong { font-size: 16px; }
.asg-bt-counts { font-size: 12px; }
.asg-bt-actions { display: flex; gap: 6px; }
.asg-role-unallotted {
  background: #fef3c7;
  color: #92400e;
}
.asg-show-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.asg-show {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.asg-show:hover { border-color: #c7d2fe; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); }
.asg-show[open] {
  background: #fff;
  border-color: #c7d2fe;
}
.asg-show > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 14px;
  user-select: none;
}
.asg-show > summary::-webkit-details-marker { display: none; }
.asg-show-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
  color: #6b7280;
}
.asg-show-caret i { width: 16px; height: 16px; }
.asg-show[open] .asg-show-caret { transform: rotate(90deg); color: #4338ca; }
.asg-show-name {
  font-weight: 500;
  color: #111827;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asg-show-count {
  font-size: 12px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.asg-show-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.asg-show-remove {
  background: transparent;
  border: 0;
  color: #9ca3af;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
  padding: 0;
}
.asg-show-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.asg-show-remove i { width: 14px; height: 14px; }
.asg-assign-select {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  max-width: 180px;
  transition: border-color 0.12s ease;
}
.asg-assign-select:hover { border-color: #6366f1; }
.asg-assign-select:focus { outline: none; border-color: #4338ca; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18); }
.asg-pages {
  padding: 4px 14px 12px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  animation: asg-fade-in 0.18s ease;
}
.asg-page-chip {
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  color: #3730a3;
  white-space: nowrap;
  text-decoration: none;
}
a.asg-page-chip:hover {
  background: #e0e7ff;
  border-color: #c7d2fe;
  cursor: pointer;
}
.asg-empty {
  margin: 6px 0 0;
  padding: 10px 14px;
  background: #fafafa;
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
}
.asg-unallotted-panel { margin-top: 18px; }
@keyframes asg-fade-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 720px) {
  .asg-show > summary { flex-wrap: wrap; }
  .asg-show-actions { width: 100%; margin-top: 4px; justify-content: flex-end; }
  .asg-pages { padding-left: 14px; }
}

/* ─── Ask-your-data floating chat ─────────────────────────────────── */
#chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand, #2563eb);
  color: #fff;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#chat-fab:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22); }
#chat-fab svg { width: 26px; height: 26px; stroke-width: 1.5; }
body.auth-locked #chat-fab,
body.auth-locked #chat-panel { display: none !important; }
body.user-mode #chat-fab,
body.user-mode #chat-panel { display: none !important; }

#chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Specificity needs to beat the display:flex rule above. Without this,
   `panel.hidden = true` toggles the attribute but the user-agent
   `[hidden] { display: none }` rule loses, so the X button did nothing. */
#chat-panel[hidden] { display: none; }
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.chat-head-actions { display: flex; gap: 4px; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-empty { text-align: center; padding: 18px 8px; font-size: 13px; }
.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.chat-msg-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg-user .chat-msg-bubble {
  background: var(--brand, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-msg-bubble {
  background: var(--bg, #f9fafb);
  border: 1px solid var(--border, #e5e7eb);
  color: var(--text, #111827);
  border-bottom-left-radius: 4px;
}
.chat-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.chat-form textarea {
  flex: 1;
  resize: none;
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
.chat-form button { align-self: flex-end; }
@media (max-width: 600px) {
  #chat-panel { right: 8px; left: 8px; width: auto; bottom: 76px; }
}

/* ==========================================================================
   Task detail drawer — right slide-in panel for the advanced task surface
   (Phase 1, 2026-05-10). Mirrors the .modal aria pattern but slides from
   the right edge so a task stays in context with the list view.
   ========================================================================== */
.task-drawer {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 30;
}
.task-drawer[aria-hidden="false"] { display: block; }
.task-drawer-backdrop {
  background: rgba(27, 34, 28, 0.42);
  inset: 0;
  position: absolute;
  backdrop-filter: blur(1.5px);
}
.task-drawer-panel {
  background: var(--surface, #fff);
  box-shadow: -10px 0 24px rgba(0,0,0,0.18);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(680px, 100vw);
  overflow: hidden;
  animation: task-drawer-in 200ms ease-out;
}
@keyframes task-drawer-in {
  from { transform: translateX(20px); opacity: 0.6; }
  to   { transform: translateX(0);    opacity: 1; }
}
.task-drawer-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  background: var(--surface-2, #f9fafb);
  display: grid; gap: 10px;
  position: relative;
}
.task-drawer-header h2 {
  margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35;
  padding-right: 28px;
}
.task-drawer-header .meta {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  font-size: 12px; color: var(--muted, #4b5563);
  align-items: center;
}
.task-drawer-header .meta strong { color: var(--text, #111827); font-weight: 600; }
.task-drawer-close {
  position: absolute; top: 12px; right: 14px;
  background: transparent; border: 0; cursor: pointer; padding: 6px; border-radius: 6px;
}
.task-drawer-close:hover { background: rgba(0,0,0,0.06); }
.task-drawer-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line, #e5e7eb);
  padding: 0 18px;
  background: var(--surface, #fff);
}
.task-drawer-tabs button {
  background: transparent; border: 0; padding: 10px 12px;
  font-size: 13px; color: var(--muted, #4b5563); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.task-drawer-tabs button:hover { color: var(--text, #111827); }
.task-drawer-tabs button.active {
  color: var(--text, #111827); font-weight: 600;
  border-bottom-color: var(--brand, #2563eb);
}
.task-drawer-tabs .tab-count {
  background: var(--surface-2, #f3f4f6);
  color: var(--muted, #4b5563);
  font-size: 11px; padding: 1px 6px; border-radius: 10px; margin-left: 4px;
}
.task-drawer-body { overflow-y: auto; padding: 18px 22px 32px; }

/* Priority + health pills */
.priority-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 10px; line-height: 1.4;
}
.task-health {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; line-height: 1.4;
}

/* Remark thread */
.task-remark-form {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2, #fafafa);
  display: grid; gap: 8px;
  margin-bottom: 16px;
}
.task-remark-form textarea {
  width: 100%; min-height: 70px; resize: vertical;
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 13px;
}
.task-remark-form .remark-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.task-remark-due-warn {
  background: #fff4e5; border: 1px solid #f5c97f;
  color: #8a4b00;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.task-remark-list { display: grid; gap: 10px; }
.task-remark-item {
  border: 1px solid var(--line, #e5e7eb); border-radius: 10px;
  padding: 10px 12px; background: var(--surface, #fff);
}
.task-remark-item .head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; margin-bottom: 4px;
  font-size: 12px; color: var(--muted, #4b5563);
}
.task-remark-item .head strong { color: var(--text, #111827); font-size: 13px; font-weight: 600; }
.task-remark-item .body { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* Activity timeline */
.task-activity-list { display: grid; gap: 4px; }
.task-activity-item {
  display: grid; grid-template-columns: 110px 1fr; gap: 10px;
  font-size: 12.5px; color: var(--muted, #4b5563);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line, #e5e7eb);
}
.task-activity-item:last-child { border-bottom: 0; }
.task-activity-item .when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12px; }
.task-activity-item .who  { color: var(--text, #111827); font-weight: 600; }
.task-activity-item .what { color: var(--muted, #4b5563); }

/* Empty state inside the drawer */
.task-drawer-empty {
  padding: 18px; text-align: center;
  color: var(--muted, #4b5563); font-size: 13px;
  border: 1px dashed var(--line, #e5e7eb); border-radius: 10px;
}

/* List-row affordance — task title becomes a click target */
.task-row-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  text-align: left; color: var(--brand, #2563eb); font: inherit;
  font-weight: 600;
}
.task-row-link:hover { text-decoration: underline; }

/* Attachments — chip strip used inside both the picker (Remark/Comment
   forms) and the rendered list items. */
.remark-attachments {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.attachment-list { display: flex; gap: 6px; flex-wrap: wrap; }
.task-attachment-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.task-attachment-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2, #f3f4f6);
  border: 1px solid var(--line, #e5e7eb);
  color: var(--text, #111827);
  padding: 3px 8px; border-radius: 999px;
  font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.task-attachment-chip:hover { background: var(--surface, #fff); border-color: var(--brand, #2563eb); color: var(--brand, #2563eb); }
.task-attachment-chip i { width: 12px; height: 12px; }
.task-attachment-chip button {
  background: transparent; border: 0; cursor: pointer;
  color: var(--muted, #4b5563); font-size: 14px; line-height: 1; padding: 0 2px;
}
.task-attachment-chip button:hover { color: #a8312a; }

/* Notification bell — anchored in the topbar; badge shows in-app unread
   count for the current viewer (Phase 3, 2026-05-10). */
.task-bell { position: relative; }
.task-bell .task-bell-badge {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #a8312a; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.task-bell-popover {
  display: none; inset: 0; position: fixed; z-index: 35;
}
.task-bell-popover[aria-hidden="false"] { display: block; }
.task-bell-popover-backdrop {
  inset: 0; position: absolute; background: transparent;
}
.task-bell-popover-panel {
  position: absolute; top: 64px; right: 18px;
  width: min(420px, calc(100vw - 36px));
  max-height: 75vh; overflow-y: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  padding: 12px 14px 16px;
}
.task-bell-popover-panel h3 {
  font-size: 14px; margin: 0 0 8px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.task-bell-popover-panel h3 button {
  background: transparent; border: 0; font-size: 12px; color: var(--brand, #2563eb); cursor: pointer; padding: 2px 6px;
}
.task-bell-popover-panel h3 button:hover { text-decoration: underline; }
.task-notif-item {
  display: grid; gap: 4px;
  padding: 8px 10px; margin: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.task-notif-item:hover { background: var(--surface-2, #f9fafb); border-color: var(--line, #e5e7eb); }
.task-notif-item.unread { background: #eaf2fd; }
.task-notif-item.unread:hover { background: #ddeaf9; }
.task-notif-item .head {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-size: 12px; color: var(--muted, #4b5563);
}
.task-notif-item .head strong { color: var(--text, #111827); font-size: 13px; font-weight: 600; }
.task-notif-item .body {
  font-size: 12.5px; color: var(--text, #111827); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-notif-empty {
  color: var(--muted, #4b5563); font-size: 13px;
  text-align: center; padding: 24px 0;
}
.task-notif-kind {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2, #f3f4f6); color: var(--muted, #4b5563); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* Tasks Analytics — KPI grid + aging bars (Phase 4, 2026-05-10) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--surface-2, #fafafa);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; gap: 12px; align-items: center;
}
.kpi-card .kpi-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5e7eb); border-radius: 8px;
}
.kpi-card .kpi-icon i { width: 16px; height: 16px; }
.kpi-title { font-size: 11.5px; color: var(--muted, #4b5563); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--text, #111827); line-height: 1.1; margin-top: 2px; }

.aging-row {
  display: grid; grid-template-columns: 110px 1fr 60px;
  gap: 12px; align-items: center;
  padding: 6px 0;
}
.aging-label { font-size: 13px; color: var(--text, #111827); font-weight: 600; }
.aging-bar {
  display: block; background: var(--surface-2, #f3f4f6);
  height: 10px; border-radius: 5px; overflow: hidden;
}
.aging-bar-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, #2563eb, #1f4d7a);
  border-radius: 5px;
}
.aging-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* ==========================================================================
   Undo bar — floating "X deleted. Undo (8s)" after destructive actions.
   Slides up from the bottom-center; hides on timer expire or undo click.
   Sits above toasts (which use z-index ~50). The bar replaces nothing —
   regular toasts still surface for non-destructive feedback.
   ========================================================================== */
.undo-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1c1e21;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  font-size: 14px;
  max-width: calc(100vw - 32px);
  opacity: 0;
  transition: opacity 160ms ease-out, transform 200ms ease-out;
  pointer-events: none;
}
.undo-bar.undo-bar-visible {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.undo-bar-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(60vw, 400px);
}
.undo-bar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #5cb0ff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.undo-bar-action:hover {
  background: rgba(92, 176, 255, 0.12);
  border-color: rgba(92, 176, 255, 0.3);
}
.undo-bar-action:focus-visible {
  outline: 2px solid #5cb0ff;
  outline-offset: 2px;
}
.undo-bar-action i,
.undo-bar-action svg {
  width: 14px;
  height: 14px;
}
.undo-bar-countdown {
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  min-width: 26px;
  text-align: right;
}
@media (max-width: 720px) {
  .undo-bar {
    bottom: 16px;
    padding: 14px 14px;
    font-size: 13px;
    width: calc(100vw - 32px);
    justify-content: space-between;
  }
  .undo-bar-label {
    max-width: 50vw;
  }
}
@media (prefers-reduced-motion: reduce) {
  .undo-bar {
    transition: opacity 0ms;
    transform: translateX(-50%);
  }
  .undo-bar.undo-bar-visible {
    transform: translateX(-50%);
  }
}

/* ==========================================================================
   Mobile touch-target hardening (WCAG 2.5.5 / Apple HIG 44pt minimum).
   The base layout uses 36px buttons which are fine on desktop but too
   small for accurate tap on a 375px phone. PWA installs run on iOS so
   these landed as real tap targets in user testing.
   ========================================================================== */
@media (max-width: 720px) {
  .icon-button {
    min-height: 44px;
    min-width: 44px;
  }
  .primary,
  .secondary,
  .danger,
  .ghost {
    min-height: 44px;
  }
  /* Don't grow .small buttons (chips, table action cells) — those would
     reflow row heights and break the table grid. They're explicit-small
     by design. */
}

/* =============================================================================
   Bold & playful UI animation system (2026-05-15)
   - First-render only — view switches + modal opens trigger entrance keyframes.
   - WS NOTIFY re-renders skip (app.js _kickViewEnterAnim gates on activeView
     change), so scroll/hover state isn't disturbed.
   - Cubic-bezier(0.34, 1.56, 0.64, 1) = springy overshoot (Notion-style).
   - prefers-reduced-motion disables everything below.
   ============================================================================= */

@keyframes pm-view-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pm-stagger-up {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pm-modal-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.86); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes pm-backdrop-fade {
  from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); }
  to   { opacity: 1; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
}
@keyframes pm-drawer-slide {
  from { transform: translateX(110%); opacity: 0.4; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes pm-toast-pop {
  0%   { opacity: 0; transform: translate(-50%, 24px) scale(0.88); }
  60%  { opacity: 1; transform: translate(-50%, -4px) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes pm-nav-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24, 119, 242, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(24, 119, 242, 0.10); }
}
@keyframes pm-count-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
@keyframes pm-active-bar {
  from { transform: scaleY(0.2); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}
@keyframes pm-icon-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  30%      { transform: rotate(-7deg) scale(1.08); }
  60%      { transform: rotate(5deg) scale(1.06); }
}

/* View enter — fades the whole view in, then staggers its top-level cards. */
.view.anim-view-enter {
  animation: pm-view-enter 320ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.view.anim-view-enter .summary-card,
.view.anim-view-enter .daily-summary-card,
.view.anim-view-enter .overview-card,
.view.anim-view-enter .metric-card,
.view.anim-view-enter .nudge-card,
.view.anim-view-enter > .card,
.view.anim-view-enter > section > .card,
.view.anim-view-enter .pivot-card,
.view.anim-view-enter .page-head {
  animation: pm-stagger-up 460ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.view.anim-view-enter .summary-card:nth-child(1),
.view.anim-view-enter .daily-summary-card:nth-child(1),
.view.anim-view-enter .overview-card:nth-child(1),
.view.anim-view-enter .metric-card:nth-child(1) { animation-delay: 30ms; }
.view.anim-view-enter .summary-card:nth-child(2),
.view.anim-view-enter .daily-summary-card:nth-child(2),
.view.anim-view-enter .overview-card:nth-child(2),
.view.anim-view-enter .metric-card:nth-child(2) { animation-delay: 70ms; }
.view.anim-view-enter .summary-card:nth-child(3),
.view.anim-view-enter .daily-summary-card:nth-child(3),
.view.anim-view-enter .overview-card:nth-child(3),
.view.anim-view-enter .metric-card:nth-child(3) { animation-delay: 110ms; }
.view.anim-view-enter .summary-card:nth-child(4),
.view.anim-view-enter .daily-summary-card:nth-child(4),
.view.anim-view-enter .overview-card:nth-child(4),
.view.anim-view-enter .metric-card:nth-child(4) { animation-delay: 150ms; }
.view.anim-view-enter .summary-card:nth-child(5),
.view.anim-view-enter .daily-summary-card:nth-child(5),
.view.anim-view-enter .overview-card:nth-child(5),
.view.anim-view-enter .metric-card:nth-child(5) { animation-delay: 190ms; }
.view.anim-view-enter .summary-card:nth-child(n+6),
.view.anim-view-enter .daily-summary-card:nth-child(n+6),
.view.anim-view-enter .overview-card:nth-child(n+6),
.view.anim-view-enter .metric-card:nth-child(n+6) { animation-delay: 220ms; }
.view.anim-view-enter > section { animation: pm-view-enter 380ms cubic-bezier(0.34, 1.56, 0.64, 1) 60ms backwards; }
.view.anim-view-enter .table-wrap,
.view.anim-view-enter table { animation: pm-view-enter 420ms cubic-bezier(0.34, 1.56, 0.64, 1) 180ms backwards; }

/* Modal pop entrance — keyframe re-fires every time aria-hidden flips
   true→false because the selector starts matching anew. */
.modal[aria-hidden="false"] .modal-panel {
  animation: pm-modal-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal[aria-hidden="false"] .modal-backdrop {
  animation: pm-backdrop-fade 260ms ease-out;
}
.modal[aria-hidden="false"] .modal-body > * {
  animation: pm-stagger-up 360ms cubic-bezier(0.34, 1.56, 0.64, 1) 120ms backwards;
}

/* Task drawer — supersede the existing task-drawer-in with a punchier slide. */
.task-drawer[aria-hidden="false"] .task-drawer-panel {
  animation: pm-drawer-slide 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.task-drawer[aria-hidden="false"] .task-drawer-backdrop {
  animation: pm-backdrop-fade 240ms ease-out;
}

/* Toast — punchy springy pop replacing the flat transition. */
.toast.show {
  animation: pm-toast-pop 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Sidebar nav — hover lift + active-state animated bar + count-pill pulse. */
.nav button {
  position: relative;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease;
}
.nav button:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 12px -6px rgba(24, 119, 242, 0.25);
}
.nav button:active { transform: translateX(2px) scale(0.97); }
.nav button.active::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: var(--green, #1877f2);
  transform-origin: center;
  animation: pm-active-bar 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(24, 119, 242, 0.55);
}
.nav button.active svg { animation: pm-icon-wiggle 480ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.nav button.active .count-pill { animation: pm-count-pulse 600ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Buttons — springy press + hover lift for primary/secondary/ghost. */
.primary, .secondary, .ghost, .danger {
  transition: background-color 180ms ease, border-color 180ms ease,
              transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 180ms ease, color 180ms ease;
}
.primary:hover  { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(24, 119, 242, 0.55); }
.secondary:hover, .ghost:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -10px rgba(0,0,0,0.18); }
.danger:hover   { transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(220, 38, 38, 0.45); }
.primary:active, .secondary:active, .ghost:active, .danger:active {
  transform: translateY(1px) scale(0.97);
}

/* Icon buttons (topbar bell, search, etc.) — subtle press. */
.icon-button {
  transition: background-color 160ms ease, transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 160ms ease;
}
.icon-button:hover { transform: scale(1.08); }
.icon-button:active { transform: scale(0.92); }
.task-bell:hover svg { animation: pm-icon-wiggle 540ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Card-style surfaces — hover lift wherever we have a card.
   Scoped so it never applies inside a table cell (table rows already
   own their own hover state and we don't want them jumping). */
.summary-card,
.daily-summary-card,
.overview-card,
.metric-card,
.nudge-card,
.pivot-card,
.sidebar-month-card {
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 220ms ease,
              border-color 220ms ease;
}
.summary-card:hover,
.daily-summary-card:hover,
.overview-card.clickable:hover,
.metric-card:hover,
.nudge-card:hover,
.pivot-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.28);
}

/* Table rows — gentle hover scale (no transform-jank because we only
   change background-color + the row inherits its own row-height). */
tbody tr {
  transition: background-color 140ms ease, box-shadow 180ms ease;
}
tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--green, #1877f2);
}

/* Brand mark — extra sparkle on the sidebar logo + login card pulse. */
.sidebar .brand-mark {
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 320ms ease;
}
.sidebar .brand-mark:hover {
  transform: rotate(-6deg) scale(1.08);
  box-shadow: 0 8px 22px -10px rgba(24, 119, 242, 0.55);
}

/* prefers-reduced-motion — strip every animation we just added.
   Hover/active transforms are kept for tactile feedback (they're
   user-driven, not auto-playing) but at very short durations. */
@media (prefers-reduced-motion: reduce) {
  .view.anim-view-enter,
  .view.anim-view-enter *,
  .modal[aria-hidden="false"] .modal-panel,
  .modal[aria-hidden="false"] .modal-backdrop,
  .modal[aria-hidden="false"] .modal-body > *,
  .task-drawer[aria-hidden="false"] .task-drawer-panel,
  .task-drawer[aria-hidden="false"] .task-drawer-backdrop,
  .toast.show,
  .nav button.active::before,
  .nav button.active svg,
  .nav button.active .count-pill,
  .task-bell:hover svg,
  .sidebar .brand-mark {
    animation: none !important;
  }
  .nav button:hover,
  .primary:hover, .secondary:hover, .ghost:hover, .danger:hover,
  .icon-button:hover,
  .summary-card:hover, .daily-summary-card:hover,
  .overview-card.clickable:hover, .metric-card:hover,
  .nudge-card:hover, .pivot-card:hover,
  .sidebar .brand-mark:hover {
    transform: none !important;
    box-shadow: inherit !important;
  }
}

/* ===== Sprint 1 (2026-05-15) global UI primitives ============== */

/* Spacing tokens (Batch B #29). Most code still writes inline padding —
   these vars make the future audit cheap and let density toggle work. */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --density-row: 1;        /* scaled by density toggle (compact/normal/spacious) */
  --focus-ring: 2px solid #1877f2;
  --focus-ring-offset: 2px;
}

/* Density toggle (Batch B #34) — body class flips table row height + form padding. */
body.density-compact {
  --density-row: 0.78;
  --space-2: 6px;
  --space-3: 10px;
  --space-4: 12px;
}
body.density-spacious {
  --density-row: 1.22;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
}
body.density-compact table th, body.density-compact table td { padding-top: 5px !important; padding-bottom: 5px !important; }
body.density-spacious table th, body.density-spacious table td { padding-top: 11px !important; padding-bottom: 11px !important; }

/* Animation toggle (Batch B #35). body.anim-off disables every animated
   keyframe; body.anim-fast halves transition durations. The existing
   prefers-reduced-motion rules above continue to apply automatically. */
body.anim-off *,
body.anim-off *::before,
body.anim-off *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
body.anim-fast *,
body.anim-fast *::before,
body.anim-fast *::after {
  animation-duration: 180ms !important;
  transition-duration: 90ms !important;
}

/* Focus rings (Batch B #36). Visible 2px outline on every interactive
   element when keyboard-focused. :focus-visible scopes to keyboard nav
   so mouse clicks don't flash the ring. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Skeleton rows (Batch B #18) — applied via .pm-skeleton class.
   Shimmer animation respects reduced-motion (set above). */
.pm-skeleton {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--surface-3, #e4e6eb);
  border-radius: var(--radius-sm);
  height: 12px;
  min-width: 60px;
}
.pm-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: pm-skel-shimmer 1.3s linear infinite;
}
@keyframes pm-skel-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.pm-skel-row .pm-skeleton { height: 14px; }
.pm-skel-row.is-tall .pm-skeleton { height: 18px; }
.pm-skeleton-table tr { border-bottom: 1px solid var(--line); }
.pm-skeleton-table td { padding: 10px 8px; }

/* Empty state (Batch B #19). Standardised empty-state with optional
   icon + CTA. Lives inside .panel .panel-pad blocks where the table
   used to be. Same look across every table. */
.pm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}
.pm-empty-state .pm-empty-icon {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-2, #f7f8fa);
  border: 1px dashed var(--line-strong, #c5c8cc);
  color: var(--subtle, #8a8d91);
}
.pm-empty-state .pm-empty-title { font-weight: 700; font-size: 14px; color: var(--text); }
.pm-empty-state .pm-empty-hint { font-size: 13px; max-width: 360px; }
.pm-empty-state .pm-empty-actions { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Auto-hide zero badges in sidebar (Batch B #10).
   The .nav button .count-pill renders the count; when text content is
   exactly "0" we collapse to display:none so the chip never appears. */
.nav .count-pill:empty { display: none; }
.nav .count-pill[data-count="0"] { display: none; }
.nav .badge-zero-hide:empty { display: none; }

/* Mobile tap targets (Batch B #48) — 44px min height on every button on phones */
@media (max-width: 720px) {
  button:not(.tiny):not(.cm-chip), .ghost, .primary, .danger, .secondary, .icon-button {
    min-height: 44px;
  }
  .nav button { min-height: 44px; }
}

/* Dark mode (Batch B #33). Body class flips every CSS var. Existing
   selectors that read variables get the new values automatically.
   Inline-styled colors throughout the app are untouched — dark mode
   is opt-in via toggle and the user can still flip back. */
body.theme-dark {
  --bg: #18191a;
  --surface: #242526;
  --surface-2: #3a3b3c;
  --surface-3: #4e4f50;
  --line: #393a3b;
  --line-strong: #555657;
  --text: #e4e6eb;
  --muted: #b0b3b8;
  --subtle: #8a8d91;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 8px 24px rgba(0,0,0,0.5);
  color-scheme: dark;
}
body.theme-dark img:not(.no-invert-dark) { filter: brightness(0.92); }
body.theme-dark .pm-empty-state { color: var(--muted); }

/* Bottom nav (mobile, Batch B #46). Hidden by default; .pm-bottom-nav
   is rendered into the DOM and shown only on phones. */
.pm-bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  z-index: 50;
  padding: 0 8px;
  justify-content: space-around;
  align-items: center;
}
@media (max-width: 720px) {
  .pm-bottom-nav { display: flex; }
  body.has-bottom-nav main { padding-bottom: 64px; }
}
.pm-bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}
.pm-bottom-nav button.active { color: var(--green-strong); }
.pm-bottom-nav button svg { width: 22px; height: 22px; }

/* Skip-link / breadcrumbs (Batch B #1) — minimal, never wraps. */
.pm-breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 16px 0;
  flex-wrap: wrap;
}
.pm-breadcrumbs button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--green-strong);
  font-weight: 600;
  cursor: pointer;
}
.pm-breadcrumbs .pm-crumb-sep { color: var(--subtle); }
.pm-breadcrumbs .pm-crumb-current { color: var(--text); font-weight: 700; }

/* Back button (Batch B #7) — used on detail views (Page Performance detail, show summary, user detail). */
.pm-back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.pm-back-btn:hover { background: var(--surface-2); }

/* Toast with Undo (Batch B #50). Existing .toast styles already
   handle the basic toast; this extends with an inline button. */
.toast .toast-action {
  margin-left: 12px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}
.toast .toast-action:hover { background: rgba(255,255,255,0.1); }

/* Sprint 2 #B11 — sticky first column on horizontal-scroll tables.
   Apply by adding .pm-sticky-first to the table wrapper. The first
   th + first td in each row get position:sticky;left:0 so column
   headers stay aligned. Uses a subtle right shadow so the user sees
   they're separated from scrolled content. */
.pm-sticky-first thead th:first-child,
.pm-sticky-first tbody td:first-child,
.pm-sticky-first tfoot td:first-child {
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 2;
  box-shadow: 1px 0 0 var(--line), 2px 0 4px -2px rgba(0,0,0,0.08);
}
.pm-sticky-first thead th:first-child { z-index: 3; }

/* Sprint 2 #B1 — breadcrumb chip styling matches our existing crumb
   markup above; this rule scopes spacing inside pageHead. */
.page-head .pm-breadcrumbs { padding-left: 0; padding-right: 0; }

/* Sprint 2 #B7 — back button placement near page title */
.page-head .pm-back-btn { margin-right: 10px; }

/* Sprint 1/2 — heatmap cell hover */
.pm-heatmap td button:hover { filter: brightness(1.05); }
.pm-heatmap td button:focus-visible { outline: 2px solid var(--green-strong); outline-offset: 1px; }

/* Sprint 2 #15 — leaderboard medals + rows */
.panel-pad .section-title h3 { display: inline; }

/* Sprint 2 #8 — EOD digest entrance + responsive */
.pm-eod-digest {
  animation: pm-eod-slide 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pm-eod-slide {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 720px) {
  .pm-eod-digest { left: 10px; right: 10px; max-width: none; }
}

/* Sprint 3/4 #B37 — virtual table marker (set by JS when row count > 100) */
.pm-virtual-table tbody { contain: layout style; }

/* ===== Sprint 4 (2026-05-15) sidebar + mobile + polish ============== */

/* #B2 — Sidebar collapse. Reduces sidebar width and hides text labels. */
body.sidebar-collapsed .sidebar { width: 64px !important; min-width: 64px; }
body.sidebar-collapsed .nav-item span:not(.count-pill),
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .nav-search-wrap input,
body.sidebar-collapsed .brand-mark span,
body.sidebar-collapsed .sidebar .sidebar-month-card,
body.sidebar-collapsed .nav-pin-toggle { display: none !important; }
body.sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .nav-search-wrap { padding: 6px 4px; }
body.sidebar-collapsed .main { margin-left: 64px !important; }

/* #B4 — sidebar search input. Matches surface. */
.nav-search-wrap input:focus { border-color: var(--green-strong); outline: 0; }

/* #B9 — active section spotlight. Current section header gets accent. */
.nav-section.is-active-section {
  color: var(--green-strong) !important;
  border-left: 3px solid var(--green-strong);
  padding-left: 9px !important;
  font-weight: 700;
}

/* #B3 — Pinned views section is visually distinct */
.nav-row { width: 100%; }
.nav-row:hover .nav-pin-toggle { opacity: 1 !important; }
.nav-row:focus-within .nav-pin-toggle { opacity: 1 !important; }
.nav-pin-toggle:hover { color: #f59e0b !important; }

/* #B33 — Dark mode: extend palette inversions into sidebar, modals, etc. */
body.theme-dark .sidebar { background: #242526 !important; }
body.theme-dark .topbar { background: #242526 !important; border-bottom-color: #393a3b !important; }
body.theme-dark .panel { background: #242526 !important; border-color: #393a3b !important; }
body.theme-dark .modal-panel { background: #242526 !important; color: #e4e6eb !important; }
body.theme-dark .pm-eod-digest { background: #242526 !important; color: #e4e6eb !important; }
body.theme-dark .cmdk-panel { background: #242526 !important; color: #e4e6eb !important; }
body.theme-dark .cmdk-panel input { color: #e4e6eb !important; }
body.theme-dark .pm-empty-state { color: #b0b3b8; }
body.theme-dark table { color: #e4e6eb; }
body.theme-dark table th { background: #3a3b3c; color: #e4e6eb; }

/* #B32 — Color-blind safe palette. Switch ambiguous green/red status pills
   to include shape cues. */
.status-pill.is-success::before { content: "✓ "; font-weight: 700; }
.status-pill.is-error::before, .status-pill.is-danger::before { content: "✗ "; font-weight: 700; }
.status-pill.is-warn::before, .status-pill.is-warning::before { content: "● "; }

/* #B6 — Keyboard nav for sidebar */
.nav-item:focus-visible {
  background: var(--green-soft);
  outline: var(--focus-ring);
  outline-offset: -2px;
}

/* #B39 — Lazy-load image fade-in */
img.pm-lazy { opacity: 0; transition: opacity 220ms ease-out; }
img.pm-lazy.loaded { opacity: 1; }

/* Command palette entrance */
.cmdk-panel { animation: pm-cmdk-pop 240ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pm-cmdk-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* #B47 — Pull-to-refresh visual cue */
.pm-ptr-indicator {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--surface, #fff); border: 1px solid var(--green-strong);
  color: var(--green-strong);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  z-index: 90;
  opacity: 0;
  transition: opacity 200ms;
  pointer-events: none;
}
.pm-ptr-indicator.visible { opacity: 1; }

