@font-face {
  font-family: 'Integral CF';
  src: url('/static/fonts/Fontspring-DEMO-integralcf-bold-subset.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sora';
  src: url('/static/fonts/Sora-VariableFont_wght-subset.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Neue Haas Grotesk Display Pro';
  src: url('/static/fonts/neue-haas-grotesk-display-pro-65-medium-subset.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-red: #630000;
  --brand-cream: #fffad9;
  --brand-teal: #0a5b55;
  --brand-ink: #161616;
  --brand-border: #ded4b1;
  --brand-panel: #fffdf0;
  --brand-panel-strong: #fff8da;
  --brand-muted: #5a5247;
  --shadow-soft: 0 18px 40px rgba(58, 18, 10, 0.1);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-btn: 14px;
  --ease-standard: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur-mid: 220ms;
  --dur-slow: 300ms;
  --app-bg:
    radial-gradient(circle at top left, rgba(255, 250, 217, 0.98), rgba(248, 239, 206, 0.96) 40%, rgba(244, 234, 194, 0.95) 75%),
    linear-gradient(135deg, rgba(10, 91, 85, 0.06), transparent 30%, rgba(99, 0, 0, 0.03));
  --panel-grad-start: rgba(255, 253, 240, 0.96);
  --panel-grad-end: rgba(255, 250, 226, 0.96);
  --input-bg: rgba(255, 255, 255, 0.7);
  --input-bg-strong: rgba(255, 255, 255, 0.86);

  /* ── Layer tokens (z-index) ──────────────────────────────────────────────
     Canonical stacking order. New rules should use these instead of raw numbers
     so the hierarchy stays consistent. Existing rules are kept as-is to avoid
     regressions and should be migrated incrementally.

     base    → in-flow content / low-stack UI chrome
     raised  → sticky headers, drawer shadows, inline popups
     sidebar → app sidebar / main nav surfaces
     drawer  → side drawers and slide-over panels
     overlay → modal backdrops
     modal   → modal panels (sit above overlay)
     popover → dropdowns, menus, autocompletes (sit above modal)
     tooltip → tooltips (always on top of interactive layers)
     toast   → transient notifications (always topmost)
  */
  --z-base: 1;
  --z-raised: 10;
  --z-sidebar: 90;
  --z-drawer: 220;
  --z-overlay: 460;
  --z-modal: 600;
  --z-popover: 1000;
  --z-tooltip: 9000;
  --z-toast: 10000;
}

:root[data-theme='dark'] {
  --brand-red: #c95a5a;
  --brand-cream: #161616;
  --brand-teal: #41a39a;
  --brand-ink: #fff5dc;
  --brand-border: #3a3a3a;
  --brand-panel: #1e1e1e;
  --brand-panel-strong: #242424;
  --brand-muted: #d4ccb8;
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.34);
  --app-bg:
    radial-gradient(circle at top left, rgba(28, 28, 28, 0.99), rgba(22, 22, 22, 0.98) 48%, rgba(16, 16, 16, 0.98) 78%),
    linear-gradient(135deg, rgba(65, 163, 154, 0.08), transparent 35%, rgba(142, 35, 35, 0.08));
  --panel-grad-start: rgba(36, 36, 36, 0.96);
  --panel-grad-end: rgba(28, 28, 28, 0.96);
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-bg-strong: rgba(255, 255, 255, 0.09);
  --scroll-track: rgba(255, 245, 220, 0.14);
  --scroll-thumb: rgba(255, 245, 220, 0.62);
  --scroll-thumb-hover: rgba(255, 245, 220, 0.86);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
  --scroll-track: rgba(99, 0, 0, 0.08);
  --scroll-thumb: rgba(99, 0, 0, 0.45);
  --scroll-thumb-hover: rgba(99, 0, 0, 0.62);
}

html,
body {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

body {
  margin: 0;
  color: var(--brand-ink);
  font-family: 'Neue Haas Grotesk Display Pro', 'Avenir Next', 'Segoe UI', sans-serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  background: var(--app-bg);
  transition: background var(--dur-slow) var(--ease-soft), color var(--dur-slow) var(--ease-soft);
}

a { color: inherit; transition: color var(--dur-fast) var(--ease-standard); }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--brand-muted); font-weight: 400; font-style: normal; }
.tiny { font-size: 12px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

.login-body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 54px,
    rgba(22, 22, 22, 0.055) 54px,
    rgba(22, 22, 22, 0.055) 55px
  );
  opacity: 0.55;
}

.login-topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.login-return-link,
.login-theme-toggle {
  pointer-events: auto;
}

.login-return-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  transition: background-color 160ms var(--ease-soft), color 160ms var(--ease-soft), border-color 160ms var(--ease-soft);
}

.login-return-link .brand-mark {
  width: 34px;
  height: 34px;
}

.login-theme-toggle {
  min-height: 34px;
}

.login-return-link:hover,
.login-return-link:focus-visible {
  background: rgba(255, 255, 255, 0.9);
  color: rgba(22, 22, 22, 0.96);
}

.login-shell { width: 100%; max-width: 520px; }
.login-card,
.panel {
  background: linear-gradient(180deg, var(--panel-grad-start), var(--panel-grad-end));
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.login-card {
  padding: 30px;
  position: relative;
  z-index: 2;
}

.auth-transition-card {
  animation: auth-enter 260ms var(--ease-soft);
  transform-origin: center top;
}

body.auth-leaving .auth-transition-card {
  animation: auth-leave 180ms ease forwards;
}

@keyframes auth-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes auth-leave {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.99);
  }
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand-center {
  justify-content: center;
  text-align: center;
}

.login-brand-center > div {
  display: grid;
  justify-items: center;
}

.login-brand-left {
  justify-content: flex-start;
  text-align: left;
}

.login-brand-left > div {
  display: grid;
  justify-items: start;
}

.brand-lockup-wide {
  gap: 16px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-mark-large {
  width: 56px;
  height: 56px;
}

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

.wordmark-divider {
  width: 48px;
  height: 2px;
  background: var(--brand-teal);
}

.brand-kicker {
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 700;
}

.brand-sub {
  color: var(--brand-teal);
  font-size: 12px;
}

.inline-edit {
  width: min(520px, 100%);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: var(--brand-teal);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.detail-link:hover,
.detail-link:focus-visible {
  color: #0f6b64;
}

h1, .workspace-heading {
  font-family: 'Integral CF', 'Avenir Next', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

/* Dynamic-content headings — switch to Sora to avoid DEMO font watermark characters */
#welcome,
.workspace-heading {
  font-family: 'Sora', 'Avenir Next', sans-serif;
  letter-spacing: -0.04em;
}

h2, h3 {
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 700;
  letter-spacing: -0.075em;
}

.login-card h1 {
  margin-top: 18px;
  font-size: clamp(34px, 6vw, 52px);
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.login-card .brand-mark {
  filter: none;
}

.register-heading {
  font-size: clamp(38px, 10.5vw, 52px) !important;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.no-access-card {
  max-width: 620px;
}

.no-access-title {
  white-space: normal !important;
  line-height: 0.98;
  font-size: clamp(44px, 6.2vw, 64px) !important;
  text-wrap: balance;
}

.stack-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(142, 0, 0, 0.3);
  background: rgba(142, 0, 0, 0.08);
  color: var(--wine);
  font-size: 0.95rem;
  font-weight: 600;
}

.form-error a {
  color: var(--brand-teal);
  text-decoration: none;
}

.form-error a:hover,
.form-error a:focus-visible {
  text-decoration: underline;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-muted);
  font-size: 13px;
  font-weight: 600;
}

.inline-check input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.inhouse-check input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-teal);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 74px;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 58px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: var(--input-bg-strong);
  color: var(--brand-ink);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
  background: #fff;
  border-color: rgba(10, 91, 85, 0.35);
}

.login-links {
  margin-top: 10px;
}

.login-links a {
  color: var(--brand-teal);
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
}

.login-links a:hover,
.login-links a:focus-visible {
  text-decoration: underline;
}

.register-denied {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(99, 0, 0, 0.2);
  border-radius: var(--radius-md);
  background: rgba(99, 0, 0, 0.04);
  display: grid;
  gap: 8px;
}

.register-calendly-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(22, 22, 22, 0.08);
  background: #fff;
}

.register-calendly-wrap iframe {
  width: 100%;
  min-height: 360px;
  border: 0;
}

.file-upload-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
}

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

.file-pick-btn {
  padding: 8px 12px;
  font-size: 0.9rem;
  line-height: 1;
}

.file-upload-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-upload-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(22, 22, 22, 0.14);
  flex: 0 0 auto;
}

.file-upload-name {
  font-size: 0.95rem;
  color: var(--brand-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.register-file-upload-wrap .file-upload-meta {
  flex: 1;
  justify-content: flex-end;
}

.register-file-upload-wrap .file-upload-preview {
  cursor: zoom-in;
}

.register-avatar-preview-card {
  width: min(520px, calc(100vw - 26px));
  z-index: 120;
}

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  padding: 12px 14px;
  color: var(--brand-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.18);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button,
.link-btn,
.mini-btn {
  border: 0;
  border-radius: var(--radius-btn);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button,
.link-btn {
  background: linear-gradient(135deg, #740000, #4c0000);
  color: white;
  padding: 11px 16px;
  font-weight: 600;
}

/* Primary action buttons: subtle lift on hover, press-down on active */
button.link-btn:hover,
a.link-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22, 22, 22, 0.12);
}

button.link-btn:active,
a.link-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(22, 22, 22, 0.1);
}

/* Disabled state for all interactive elements */
button:disabled,
button[disabled],
.link-btn:disabled,
.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

#newVideoButton {
  position: relative;
  overflow: hidden;
  transition: padding var(--dur-fast) var(--ease-standard), transform 160ms ease, box-shadow 160ms ease;
  padding-left: 16px;
}

#newVideoButton::before {
  content: '+';
  display: inline-block;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  max-width: 0;
  margin-right: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: max-width var(--dur-fast) var(--ease-standard), margin-right var(--dur-fast) var(--ease-standard), opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

#newVideoButton:hover::before,
#newVideoButton:focus-visible::before {
  max-width: 12px;
  margin-right: 6px;
  opacity: 1;
  transform: translateX(0);
}

#newVideoButton:hover,
#newVideoButton:focus-visible {
  padding-left: 20px;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(22, 22, 22, 0.14);
}

#newVideoButton::after {
  content: 'New video';
  position: absolute;
  right: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(50%) translateY(4px);
  background: rgba(22, 22, 22, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 8;
}

#newVideoButton:hover::after,
#newVideoButton:focus-visible::after {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.link-btn-secondary,
.mini-btn {
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.1);
}

.link-btn-secondary:hover,
.mini-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(22, 22, 22, 0.18);
}

.link-btn-secondary:active,
.mini-btn:active {
  background: rgba(255, 255, 255, 0.65);
  transform: translateY(0);
}

.mini-btn {
  padding: 9px 13px;
  font-size: 13px;
}

.theme-toggle-btn {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms var(--ease-standard), border-color 160ms var(--ease-standard), color 160ms var(--ease-standard);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  color: var(--brand-teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms var(--ease-standard);
}

.theme-toggle-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:root[data-theme='dark'] .theme-toggle-icon {
  color: #fff5dc;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(10, 91, 85, 0.34);
  color: var(--brand-ink);
}

.site-return-link {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 160ms var(--ease-soft), color 160ms var(--ease-soft), border-color 160ms var(--ease-soft);
}

.site-return-link:hover,
.site-return-link:focus-visible {
  background: rgba(255, 255, 255, 0.9);
}

.site-return-link .brand-mark {
  transition: none;
}

:root[data-theme='dark'] .login-body::before {
  background-image: repeating-linear-gradient(
    to right,
    transparent 0,
    transparent 54px,
    rgba(255, 245, 220, 0.1) 54px,
    rgba(255, 245, 220, 0.1) 55px
  );
  opacity: 0.28;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
  background: rgba(255, 249, 227, 0.86);
  backdrop-filter: blur(12px);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.topbar-app {
  box-shadow: 0 10px 30px rgba(22, 22, 22, 0.05);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 45;
}

/* Editor usage ticker */
.editor-usage-ticker {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.editor-usage-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  margin-right: 4px;
}

.editor-usage-count {
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.editor-usage-count.over-quota {
  color: var(--brand-teal);
  font-weight: 800;
}

.editor-usage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  color: var(--brand-text);
  transition: background 0.15s;
  line-height: 1;
  padding: 0;
}

.editor-usage-btn:hover {
  background: rgba(22, 22, 22, 0.06);
}

:root[data-theme='dark'] .editor-usage-ticker {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

:root[data-theme='dark'] .editor-usage-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: inherit;
}

:root[data-theme='dark'] .editor-usage-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.mobile-top-menu-toggle,
.mobile-tools-toggle {
  display: none;
}

.profile-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  position: relative;
  z-index: 3;
  pointer-events: auto;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.profile-notify-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #d11313;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.topbar-theme-btn,
.topbar-notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(22,22,22,0.12);
  background: rgba(255,255,255,0.7);
  color: var(--brand-text);
  transition: background 0.15s;
}
.topbar-theme-btn:hover,
.topbar-notif-btn:hover {
  background: rgba(22,22,22,0.06);
}
:root[data-theme='dark'] .topbar-theme-btn,
:root[data-theme='dark'] .topbar-notif-btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  color: #e5e5e5;
}
:root[data-theme='dark'] .topbar-theme-btn:hover,
:root[data-theme='dark'] .topbar-notif-btn:hover {
  background: rgba(255,255,255,0.14);
}
.topbar-notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #d11313;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.7);
}
.notif-bell-menu {
  width: 320px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}
.notif-bell-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(10, 91, 85, 0.18);
  color: var(--brand-teal);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-transform: uppercase;
  pointer-events: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-btn:hover .profile-avatar {
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(22, 22, 22, 0.12);
}

.profile-card {
  min-width: min(440px, calc(100vw - 24px));
  max-width: 520px;
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 16px 30px rgba(22, 22, 22, 0.18);
  padding: 12px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

.profile-name {
  font-weight: 700;
  font-size: 16px;
}

.profile-email {
  color: var(--brand-muted);
  font-size: 13px;
}

.profile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--brand-ink);
  margin-top: 4px;
}

.checkline input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.profile-alerts-group {
  margin-top: 2px;
  padding: 10px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 10px;
}

.profile-alerts-group .meta-label {
  margin-bottom: 2px;
}

.profile-settings-card .checkline {
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(22, 22, 22, 0.09);
  font-size: 15px;
  font-weight: 600;
}

.profile-settings-card .checkline input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(22, 22, 22, 0.22);
  border-radius: 6px;
  background: #fff;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(22, 22, 22, 0.05);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.profile-settings-card .checkline:hover input[type="checkbox"] {
  border-color: rgba(10, 91, 85, 0.42);
}

.profile-settings-card .checkline input[type="checkbox"]:checked {
  background: rgba(10, 91, 85, 0.18);
  border-color: rgba(10, 91, 85, 0.7);
}

.profile-settings-card .checkline input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 5px;
  height: 11px;
  border: solid var(--brand-teal);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.profile-actions .link-btn {
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.profile-mentions-block {
  margin-top: 10px;
  border-top: 1px solid rgba(22, 22, 22, 0.08);
  padding-top: 10px;
  display: grid;
  gap: 8px;
}

.profile-mentions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-mentions-head p {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.profile-mentions-head .mini-btn {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
}

.video-card.is-notification-focus {
  box-shadow: 0 0 0 2px rgba(209, 19, 19, 0.34), 0 12px 22px rgba(209, 19, 19, 0.16);
  border-color: rgba(209, 19, 19, 0.45);
  animation: board-notify-pulse 900ms ease;
}

@keyframes board-notify-pulse {
  0% { transform: translateY(0); }
  35% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

.profile-mentions-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.profile-mention-item {
  width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  padding: 8px;
  text-align: left;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  cursor: pointer;
  color: inherit;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.profile-mention-item.is-unread {
  border-color: rgba(99, 0, 0, 0.25);
  background: rgba(99, 0, 0, 0.06);
}

.profile-mention-item:hover,
.profile-mention-item:focus-visible {
  border-color: rgba(10, 91, 85, 0.32);
  background: rgba(10, 91, 85, 0.08);
}

.profile-mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(10, 91, 85, 0.18);
  color: var(--brand-teal);
  border: 1px solid rgba(22, 22, 22, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-mention-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-mention-topline {
  font-size: 12px;
  color: var(--brand-muted);
}

.profile-mention-video {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-ink);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.profile-mention-body {
  font-size: 12px;
  color: var(--brand-ink);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.profile-mentions-empty {
  font-size: 12px;
  color: var(--brand-muted);
  padding: 4px 2px;
}

.profile-settings-card {
  min-width: min(430px, calc(100vw - 28px));
  max-width: 480px;
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 20px 36px rgba(22, 22, 22, 0.2);
}

.profile-settings-card .floating-menu-head p {
  color: var(--brand-ink);
}

.profile-settings-card .mini-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-muted);
  border-color: rgba(22, 22, 22, 0.14);
}

.profile-settings-card label {
  font-weight: 700;
  color: var(--brand-ink);
}

.profile-settings-card input[type='file'] {
  padding: 10px;
}

.profile-file-upload-wrap {
  min-height: 54px;
  background: rgba(255, 255, 255, 0.84);
}

.profile-file-upload-wrap .file-pick-btn {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(22, 22, 22, 0.16);
  color: var(--brand-ink);
  font-weight: 700;
}

.profile-file-upload-wrap .file-pick-btn:hover,
.profile-file-upload-wrap .file-pick-btn:focus-visible {
  border-color: rgba(10, 91, 85, 0.4);
  color: var(--brand-teal);
}

.profile-file-upload-wrap .file-upload-preview {
  cursor: zoom-in;
}

.profile-avatar-preview-card {
  width: min(520px, calc(100vw - 28px));
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 22px 34px rgba(22, 22, 22, 0.2);
}

.profile-avatar-preview-wrap {
  margin-top: 8px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  min-height: 240px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.profile-avatar-preview-wrap img {
  width: 100%;
  max-height: min(68vh, 560px);
  object-fit: contain;
  display: block;
}

.avatar-crop-stage {
  margin-top: 8px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.86);
  width: min(320px, calc(100vw - 72px));
  height: min(320px, calc(100vw - 72px));
  min-width: 220px;
  min-height: 220px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  touch-action: none;
  margin-inline: auto;
}

.avatar-crop-stage:active {
  cursor: grabbing;
}

.avatar-crop-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 38%, rgba(0, 0, 0, 0.34) 39%);
  pointer-events: none;
  z-index: 2;
}

.avatar-crop-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(22, 22, 22, 0.05);
  pointer-events: none;
  z-index: 3;
}

.avatar-crop-stage img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.avatar-crop-hint {
  margin: 8px 0 0;
  text-align: center;
}

.avatar-crop-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.avatar-crop-actions .mini-btn {
  min-height: 34px;
  padding-inline: 16px;
}

.page-shell {
  padding: 24px;
}

.workspace-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.workspace-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  text-decoration: none;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: 12px;
  padding: 14px 14px 12px;
  min-height: 118px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(252, 246, 226, 0.94));
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.15s ease;
}

.workspace-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(99, 0, 0, 0.72), rgba(10, 91, 85, 0.5));
}

.workspace-card .workspace-kicker {
  margin: 0;
  letter-spacing: 0.12em;
  font-size: 10px;
  line-height: 1.1;
  min-width: 0;
  color: rgba(99, 0, 0, 0.78);
}

.workspace-card h3,
.workspace-card .workspace-name {
  margin: 0;
  font-size: clamp(20px, 1.45vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: rgba(22, 22, 22, 0.92);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workspace-card p,
.workspace-card .workspace-open-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
  color: rgba(22, 22, 22, 0.66);
  align-self: end;
  min-width: 0;
  overflow-wrap: anywhere;
}

.workspace-card::after {
  content: '';
  position: absolute;
  right: -24px;
  bottom: -36px;
  width: 108px;
  height: 108px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(10, 91, 85, 0.12), transparent 74%);
}

.workspace-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(22, 22, 22, 0.09);
  border-color: rgba(22, 22, 22, 0.18);
}

.workspace-card:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(22, 22, 22, 0.06);
}

.workspace-card,
.sidebar-item,
.view-tab,
.link-btn,
.mini-btn,
.board-column,
.video-card,
.grid-row,
.calendar-item,
.workspace-meta,
.floating-menu-card,
.property-menu-card {
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-mid) var(--ease-soft),
    transform var(--dur-mid) var(--ease-soft),
    opacity var(--dur-fast) var(--ease-standard);
}

.workspace-actions {
  margin-top: 16px;
}

.dashboard-workspaces-panel {
  padding: 20px 18px 16px;
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-panel-head .link-btn {
  flex-shrink: 0;
  min-height: 36px;
}

.dashboard-panel-title {
  font-size: clamp(34px, 3.2vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.022em;
  overflow-wrap: anywhere;
  color: rgba(22, 22, 22, 0.94);
}

.dashboard-workspaces-panel > .muted {
  color: rgba(22, 22, 22, 0.7);
  margin-top: 4px;
}

.admin-title {
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.05;
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-shell {
  padding: 22px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
}

.admin-nav-btn {
  flex: none;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 2px);
  padding: 7px 16px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.admin-nav-btn:hover,
.admin-nav-btn:focus-visible {
  border-color: rgba(99, 0, 0, 0.18);
  color: var(--brand-red);
  background: rgba(99, 0, 0, 0.04);
}

.admin-nav-btn:active {
  transform: scale(0.97);
}

.admin-nav-btn.is-active {
  border-color: rgba(99, 0, 0, 0.2);
  background: rgba(99, 0, 0, 0.08);
  color: var(--brand-red);
}

.admin-content {
  display: grid;
  gap: 10px;
}

.admin-content-compact {
  gap: 14px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
}

.admin-toolbar-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-summary-card {
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  padding: 6px 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.admin-summary-card .tiny {
  margin: 0;
}

.admin-summary-value {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.admin-summary-value-sm {
  font-size: 14px;
}

.admin-summary-card-ok {
  border-color: rgba(10, 91, 85, 0.2) !important;
  background: rgba(10, 91, 85, 0.06) !important;
}

.admin-summary-card-warn {
  border-color: rgba(99, 0, 0, 0.2) !important;
  background: rgba(99, 0, 0, 0.05) !important;
}

.admin-summary-card-teal {
  border-color: rgba(10, 91, 85, 0.25) !important;
  background: rgba(10, 91, 85, 0.08) !important;
}

.admin-summary-card-teal .admin-summary-value {
  color: var(--brand-teal);
}

.admin-compact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  align-items: start;
}

.admin-mini-panel {
  padding: 14px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
}

.admin-panel-head {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.admin-panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-panel-heading {
  margin: 0;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 600;
}

.admin-panel-section {
  display: none;
  gap: 8px;
}

.admin-panel-section.is-active {
  display: grid;
  max-height: 70vh;
  overflow-y: auto;
}

.admin-feedback {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.admin-feedback.is-error {
  background: rgba(99, 0, 0, 0.09);
  border-color: rgba(99, 0, 0, 0.24);
  color: var(--brand-red);
}

.admin-feedback.is-success {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.26);
  color: #0a5b55;
}

.admin-role-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.admin-role-legend > div {
  padding: 4px 10px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12px;
}

.admin-role-legend strong {
  font-size: 12px;
  color: var(--brand-ink);
}

.admin-role-legend span {
  font-size: 11px;
  color: var(--brand-muted);
  line-height: 1.4;
}

.admin-users-list {
  margin-top: 0;
  display: grid;
  gap: 0;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.admin-user-row {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid rgba(22, 22, 22, 0.06);
  border-radius: 0;
  background: transparent;
  transition: background-color 0.15s ease;
}

.admin-user-row:last-child {
  border-bottom: none;
}

.admin-user-row:hover {
  background: rgba(22, 22, 22, 0.015);
}

.admin-user-workspaces {
  font-size: 11px;
  line-height: 1.35;
}

.admin-user-workspace-names {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(22, 22, 22, 0.6);
  overflow-wrap: anywhere;
}

.admin-user-row-v2 {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.admin-user-row-v2.is-open {
  background: rgba(10, 91, 85, 0.02);
  border-bottom-color: rgba(10, 91, 85, 0.12);
  box-shadow: none;
}

.admin-user-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.admin-user-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.admin-user-controls-pending {
  display: flex;
  gap: 6px;
}

.admin-user-controls select {
  min-height: 30px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.14);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-ink);
  font-size: 12px;
}

.admin-user-role-static {
  min-height: 30px;
  justify-content: center;
  pointer-events: none;
}

.admin-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.admin-status-active  { background: rgba(16,185,129,0.12); color: #065f46; }
.admin-status-inactive { background: rgba(220,38,38,0.1); color: #991b1b; }
.admin-status-invited  { background: rgba(59,130,246,0.12); color: #1d4ed8; }

.admin-btn-danger {
  color: #b91c1c;
  border-color: rgba(185,28,28,0.25) !important;
}
.admin-btn-danger:hover { background: rgba(185,28,28,0.07); }

.admin-login-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.admin-login-table th { text-align: left; padding: 4px 6px; border-bottom: 1px solid rgba(22,22,22,0.1); font-weight: 600; }
.admin-login-table td { padding: 4px 6px; border-bottom: 1px solid rgba(22,22,22,0.06); }

:root[data-theme='dark'] .admin-status-active  { background: rgba(16,185,129,0.2); color: #6ee7b7; }
:root[data-theme='dark'] .admin-status-inactive { background: rgba(220,38,38,0.2); color: #fca5a5; }
:root[data-theme='dark'] .admin-status-invited  { background: rgba(59,130,246,0.2); color: #93c5fd; }
:root[data-theme='dark'] .admin-login-table th { border-color: rgba(255,255,255,0.1); }
:root[data-theme='dark'] .admin-login-table td { border-color: rgba(255,255,255,0.06); }

.admin-user-row .member-info {
  gap: 1px;
}

.admin-user-row .member-info strong {
  font-size: 13px;
}

.admin-user-row .member-info .muted {
  font-size: 12px;
}

.admin-user-submenu {
  border-top: 1px solid rgba(22, 22, 22, 0.08);
  padding-top: 6px;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.admin-sub-list {
  display: grid;
  gap: 4px;
}

.admin-sub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.08);
  background: rgba(255, 255, 255, 0.7);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.admin-sub-row:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(22, 22, 22, 0.14);
}

.admin-sub-row-readonly {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-sub-workspace {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand-ink);
}

.admin-sub-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.admin-sub-add-row .admin-inline-menu {
  min-width: 120px;
  flex: 1;
}

.admin-inline-menu {
  position: relative;
}

.admin-inline-menu-btn {
  width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(22, 22, 22, 0.14);
}

.admin-inline-menu-btn::after {
  content: '';
  width: 8px;
  height: 8px;
  border-left: 2px solid rgba(22, 22, 22, 0.58);
  border-bottom: 2px solid rgba(22, 22, 22, 0.58);
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-top: -2px;
}

.admin-inline-menu.is-open .admin-inline-menu-btn::after {
  transform: rotate(135deg);
  margin-top: 2px;
}

.admin-inline-menu-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 90;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgba(22, 22, 22, 0.14);
  padding: 6px;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.admin-inline-menu-list.admin-inline-menu-list-popout {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  z-index: 12000;
  width: max-content;
  max-height: min(300px, calc(100vh - 16px));
}

.admin-inline-menu-option {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  color: var(--brand-ink);
  padding: 8px 9px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-inline-menu-option:hover,
.admin-inline-menu-option.is-active {
  background: rgba(10, 91, 85, 0.12);
}

.admin-inline-menu-empty {
  font-size: 12px;
  color: var(--brand-muted);
  padding: 6px 8px;
}

.admin-user-admin-note {
  margin: 0;
}

.admin-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 460;
  display: grid;
  place-items: center;
  background: rgba(22, 22, 22, 0.28);
  padding: 14px;
  animation: overlay-fade-in 0.15s ease;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.admin-confirm-overlay.hidden {
  display: none;
}

.admin-confirm-card {
  width: min(420px, calc(100vw - 24px));
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.admin-confirm-actions .link-btn {
  min-width: 92px;
}

/* ===== CONFIRM MODAL (video / comment delete) ===== */

.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 470;
  display: none;
  place-items: center;
  background: rgba(22, 22, 22, 0.38);
  padding: 14px;
  animation: overlay-fade-in 0.15s ease;
}

.confirm-modal-overlay.is-visible {
  display: grid;
}

.confirm-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 24px;
  width: min(420px, calc(100vw - 24px));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.confirm-modal-box h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.confirm-modal-warning {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

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

.confirm-modal-actions .btn-secondary {
  padding: 7px 16px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.88rem;
}

.confirm-modal-actions .btn-danger {
  padding: 7px 16px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.confirm-modal-actions .btn-danger:hover {
  background: #a93226;
}

/* ===== EDITOR USAGE HELP ICON ===== */

.editor-usage-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: help;
  margin-right: 2px;
  flex-shrink: 0;
  position: relative;
}

.approved-email-add {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.approved-email-add-workspaces {
  position: relative;
}

.approved-email-workspace-btn {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-ink);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.approved-email-workspace-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 45;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(22, 22, 22, 0.14);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgba(22, 22, 22, 0.14);
  max-height: 220px;
  overflow: auto;
  padding: 8px;
}

.approved-email-workspace-list {
  display: grid;
  gap: 6px;
}

.approved-email-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.approved-email-card {
  padding: 10px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.approved-email-card:hover {
  border-color: rgba(22, 22, 22, 0.14);
  background: rgba(255, 255, 255, 0.76);
}

.approved-email-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.approved-email-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
}

.approved-email-value {
  margin: 0;
  font-weight: 600;
  color: var(--brand-ink);
  overflow-wrap: anywhere;
}

.approved-email-access-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.approved-email-empty {
  font-size: 12px;
  color: var(--brand-muted);
}

.approved-email-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.approved-email-role-badge {
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-ink);
  background: rgba(255, 255, 255, 0.9);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-user-inline-role {
  margin-left: 8px;
  vertical-align: middle;
}

.member-avatar.member-avatar-image {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.member-avatar.member-avatar-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.member-avatar-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.member-avatar.member-avatar-image.is-fallback .member-avatar-fallback {
  display: inline-flex;
}

.member-avatar.member-avatar-image.is-fallback img {
  display: none;
}

.role-tone-owner {
  border-color: rgba(122, 90, 0, 0.34) !important;
  background: rgba(248, 229, 168, 0.4) !important;
  color: #6f5100 !important;
}

.role-tone-admin {
  border-color: rgba(127, 0, 0, 0.34) !important;
  background: rgba(157, 0, 0, 0.12) !important;
  color: #7f0000 !important;
}

.role-tone-editor {
  border-color: rgba(148, 104, 0, 0.34) !important;
  background: rgba(210, 156, 28, 0.14) !important;
  color: #8a5c00 !important;
}

.role-tone-client {
  border-color: rgba(10, 91, 85, 0.34) !important;
  background: rgba(10, 91, 85, 0.12) !important;
  color: #0a5b55 !important;
}

.role-tone-viewer {
  border-color: rgba(70, 70, 70, 0.28) !important;
  background: rgba(22, 22, 22, 0.07) !important;
  color: #3f3f3f !important;
}

.admin-inline-menu-option.role-tone-owner,
.admin-inline-menu-option.role-tone-admin,
.admin-inline-menu-option.role-tone-editor,
.admin-inline-menu-option.role-tone-client,
.admin-inline-menu-option.role-tone-viewer {
  border: 1px solid transparent;
}

.admin-inline-menu-option.role-tone-owner.is-active,
.admin-inline-menu-option.role-tone-admin.is-active,
.admin-inline-menu-option.role-tone-editor.is-active,
.admin-inline-menu-option.role-tone-client.is-active,
.admin-inline-menu-option.role-tone-viewer.is-active {
  border-color: currentColor;
}

.approved-email-editor {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(22, 22, 22, 0.08);
  display: grid;
  gap: 8px;
}

.approved-email-workspace-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 10px;
}

.approved-email-workspace-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--brand-ink);
}

.approved-email-workspace-pick input {
  width: 14px;
  height: 14px;
}

.approved-email-editor-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.admin-email-log-head {
  margin-top: 14px;
}

.admin-email-log-toolbar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-email-log-list {
  margin-top: 8px;
  display: block;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.admin-email-log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.66);
}

.admin-email-log-table th,
.admin-email-log-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
  font-size: 13px;
}

.admin-email-log-table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-muted);
  background: rgba(255, 252, 236, 0.92);
}

.admin-email-log-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-email-log-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-email-log-badge.is-sent {
  color: #0a5b55;
  background: rgba(10, 91, 85, 0.11);
  border-color: rgba(10, 91, 85, 0.25);
}

.admin-email-log-badge.is-failed {
  color: #7f0000;
  background: rgba(127, 0, 0, 0.09);
  border-color: rgba(127, 0, 0, 0.25);
}

.admin-readiness-head {
  margin-top: 14px;
}

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

.admin-readiness-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-readiness-card {
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  padding: 10px;
  display: grid;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.admin-readiness-card:hover {
  border-color: rgba(22, 22, 22, 0.16);
  background: rgba(255, 255, 255, 0.78);
}

.admin-readiness-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  color: var(--brand-ink);
}

.admin-readiness-card p {
  margin: 0;
}

.admin-readiness-output {
  margin: 6px 0 0;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: rgba(255, 255, 255, 0.76);
}

/* ── Changelog panel ── */
.admin-changelog-list-wrap {
  display: grid;
  gap: 10px;
}

.admin-changelog-entry {
  padding: 14px 16px;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  display: grid;
  gap: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.admin-changelog-entry:hover {
  border-color: rgba(22, 22, 22, 0.14);
  background: rgba(255, 255, 255, 0.7);
}

.admin-changelog-entry-head {
  display: grid;
  gap: 5px;
}

.admin-changelog-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-changelog-version {
  font-size: 13px;
  font-weight: 700;
}

.admin-changelog-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-changelog-items {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.admin-changelog-items li {
  font-size: 13px;
  line-height: 1.5;
}

.admin-changelog-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cl-cat-feature {
  background: rgba(10, 91, 85, 0.1);
  color: #0a5b55;
  border-color: rgba(10, 91, 85, 0.18);
}

.cl-cat-fix {
  background: rgba(99, 0, 0, 0.08);
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.15);
}

.cl-cat-security {
  background: rgba(80, 40, 120, 0.1);
  color: #5c2d91;
  border-color: rgba(80, 40, 120, 0.18);
}

.cl-cat-ui {
  background: rgba(22, 80, 160, 0.1);
  color: #1650a0;
  border-color: rgba(22, 80, 160, 0.18);
}

.admin-server-started {
  padding: 6px 0 2px;
  font-size: 12px;
  color: var(--brand-muted);
}

.approved-email-role {
  min-height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.14);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-ink);
}

.approved-email-remove {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(22, 22, 22, 0.12);
  color: rgba(22, 22, 22, 0.7);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.approved-email-remove:hover,
.approved-email-remove:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.28);
}

.property-button.is-readonly {
  opacity: 0.66;
}

.crumb {
  display: inline-block;
  text-decoration: none;
  color: var(--brand-muted);
  font-size: 13px;
  margin-bottom: 4px;
}

/* Mobile-only back link inside workspace-main (hidden on desktop) */
.mobile-back-crumb {
  display: none;
}

/* Topbar Workspaces button: shown only on mobile via media query */
.topbar-workspaces-btn {
  display: none;
}

/* Drawer handle pill: shown only on mobile bottom sheet */
.drawer-handle {
  display: none;
}

/* New video button: icon hidden on desktop, shown as compact icon on mobile */
.new-video-icon {
  display: none;
}

/* Dashboard profile menu links — button-like appearance */
.profile-menu-section {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(22, 22, 22, 0.07);
}

.profile-menu-link {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-btn);
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.profile-menu-link:hover,
.profile-menu-link:focus-visible {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(22, 22, 22, 0.18);
}

.workspace-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 88px);
  transition: grid-template-columns var(--dur-mid) var(--ease-soft), gap var(--dur-mid) var(--ease-soft);
}

.workspace-shell.has-selection {
  grid-template-columns: 240px minmax(0, 1fr);
}

.workspace-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
  gap: 0;
}

.workspace-shell.sidebar-collapsed .workspace-sidebar {
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
  overflow: hidden;
  border-width: 0;
  padding: 0;
}

.workspace-main,
.detail-drawer {
  padding: 22px;
}

.workspace-sidebar {
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  transform: translateX(0);
  opacity: 1;
  transition:
    opacity var(--dur-mid) var(--ease-standard),
    transform var(--dur-mid) var(--ease-soft),
    padding var(--dur-mid) var(--ease-soft),
    border-width var(--dur-mid) var(--ease-standard);
  /* Stick below the topbar while main content scrolls */
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(10,91,85,0.25) transparent;
}

.workspace-sidebar::-webkit-scrollbar {
  width: 4px;
}
.workspace-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.workspace-sidebar::-webkit-scrollbar-thumb {
  background: rgba(10,91,85,0.25);
  border-radius: 4px;
}
.workspace-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(10,91,85,0.45);
}

/* Dark mode sidebar scrollbar */
:root[data-theme='dark'] .workspace-sidebar {
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
:root[data-theme='dark'] .workspace-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}
:root[data-theme='dark'] .workspace-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.35);
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-toggle-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.sidebar-show-btn {
  margin-bottom: 12px;
  align-self: flex-start;
  display: block !important;
  position: relative;
  z-index: 50;
  width: auto;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.sidebar-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  word-break: break-word;
}

.sidebar-list {
  display: grid;
  gap: 8px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(22, 22, 22, 0.1);
  margin-top: 2px;
}

.sidebar-action {
  justify-self: start;
  margin-top: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.workspace-sidebar:hover .sidebar-action {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--brand-ink);
  border: 1px solid transparent;
  cursor: grab;
  transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-mid) var(--ease-soft);
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(22, 22, 22, 0.15);
  box-shadow: 0 2px 8px rgba(22, 22, 22, 0.08);
}

:root[data-theme='dark'] .sidebar-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-list.is-reordering .sidebar-item {
  transition: transform 140ms ease, opacity 140ms ease;
}

.sidebar-item.is-drag-source {
  opacity: 0.45;
  transform: scale(0.98);
  cursor: grabbing;
}

.sidebar-item.is-active {
  background: rgba(10, 91, 85, 0.12);
  border-color: rgba(10, 91, 85, 0.22);
}

.sidebar-title {
  font-weight: 700;
  font-size: 13px;
}

.sidebar-sub {
  font-size: 11px;
  color: var(--brand-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#newWorkspaceSidebar {
  position: relative;
  overflow: hidden;
  transition: padding var(--dur-fast) var(--ease-standard), transform 160ms ease, box-shadow 160ms ease;
  padding-left: 16px;
}

#newWorkspaceSidebar::before {
  content: '+';
  display: inline-block;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  max-width: 0;
  margin-right: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: max-width var(--dur-fast) var(--ease-standard), margin-right var(--dur-fast) var(--ease-standard), opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

#newWorkspaceSidebar:hover::before,
#newWorkspaceSidebar:focus-visible::before {
  max-width: 12px;
  margin-right: 6px;
  opacity: 1;
  transform: translateX(0);
}

#newWorkspaceSidebar:hover,
#newWorkspaceSidebar:focus-visible {
  padding-left: 20px;
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(22, 22, 22, 0.14);
}

#newWorkspaceSidebar::after {
  content: 'New workspace';
  position: absolute;
  right: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(50%) translateY(4px);
  background: rgba(22, 22, 22, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 8;
}

#newWorkspaceSidebar:hover::after,
#newWorkspaceSidebar:focus-visible::after {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.workspace-main {
  min-width: 0;
}

.workspace-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

.workspace-meta-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
}

.editable-hero-row {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  position: static;
  padding-right: 0;
  width: fit-content;
  max-width: 100%;
}

.workspace-meta-edit {
  margin-top: 12px;
}

.hero-eyebrow {
  color: var(--brand-teal);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
}

.workspace-heading {
  font-size: clamp(44px, 6vw, 74px);
  max-width: 12ch;
}

.workspace-title-pending {
  visibility: hidden;
}

.workspace-copy {
  margin-top: 12px;
  max-width: 56ch;
  color: var(--brand-muted);
}

.workspace-meta {
  position: relative;
  min-width: 0;
  width: fit-content;
  max-width: min(100%, 340px);
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(10, 91, 85, 0.08), rgba(10, 91, 85, 0.02));
  border: 1px solid rgba(10, 91, 85, 0.15);
}

.meta-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-muted);
  margin-bottom: 8px;
}

.meta-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
}

.workspace-meta a {
  color: var(--brand-red);
  font-weight: 700;
  text-decoration: none;
}

#workspaceDriveLink {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
}

.workspace-meta-instagram {
  min-width: 188px;
  padding-right: 6px;
}

#workspaceInstagramLink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  white-space: nowrap;
}

.instagram-link-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
}

.instagram-link-logo svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  color: var(--brand-red);
}

.edit-inline-btn {
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 160ms ease;
}

#workspaceDriveLink {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
}

.editable-hero-row:hover .edit-inline-btn,
.workspace-meta:hover .edit-inline-btn,
.editable-hero-row:focus-within .edit-inline-btn,
.workspace-meta:focus-within .edit-inline-btn {
  opacity: 1;
}

.edit-icon-btn {
  width: 28px;
  height: 24px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(22, 22, 22, 0.14);
  color: rgba(22, 22, 22, 0.7);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.edit-icon-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edit-icon-btn:hover {
  background: #fff;
  color: rgba(22, 22, 22, 0.9);
  border-color: rgba(22, 22, 22, 0.2);
}

#editWorkspaceTitle {
  position: static;
  margin-top: 8px;
  flex: 0 0 auto;
  align-self: flex-start;
}

#editWorkspaceDrive {
  position: absolute;
  top: 10px;
  right: 10px;
}

#editWorkspaceInstagram {
  position: absolute;
  top: 10px;
  right: 10px;
}

.view-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mobile-menu-card {
  min-width: min(280px, calc(100vw - 24px));
  max-width: min(320px, calc(100vw - 24px));
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.99), rgba(252, 246, 223, 0.99)) !important;
  color: var(--brand-ink) !important;
  border: 1px solid rgba(22, 22, 22, 0.12) !important;
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.2) !important;
}

#mobileTopMenu .floating-menu-card,
#mobileToolsMenu .floating-menu-card {
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.99), rgba(252, 246, 223, 0.99)) !important;
  color: var(--brand-ink) !important;
  border: 1px solid rgba(22, 22, 22, 0.14) !important;
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.18) !important;
}

#mobileTopMenu .floating-menu-head p,
#mobileToolsMenu .floating-menu-head p {
  color: var(--brand-ink) !important;
}

#mobileTopMenu .floating-menu-option,
#mobileToolsMenu .floating-menu-option {
  color: var(--brand-ink) !important;
  background: rgba(255, 255, 255, 0.82) !important;
  border: 1px solid rgba(22, 22, 22, 0.1) !important;
  box-shadow: none !important;
}

#mobileTopMenu .floating-menu-option:hover,
#mobileTopMenu .floating-menu-option.is-active,
#mobileToolsMenu .floating-menu-option:hover,
#mobileToolsMenu .floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.1) !important;
  border-color: rgba(10, 91, 85, 0.24) !important;
}

.mobile-menu-card .floating-menu-head p {
  color: var(--brand-ink) !important;
  font-size: 16px;
}

.mobile-menu-card .mini-btn {
  background: rgba(255, 255, 255, 0.9) !important;
  color: var(--brand-muted) !important;
  border-color: rgba(22, 22, 22, 0.14) !important;
}

.mobile-menu-list {
  display: grid;
  gap: 6px;
  max-height: min(62vh, 420px);
  overflow: auto;
}

.mobile-menu-card .floating-menu-option {
  color: var(--brand-ink) !important;
  background: rgba(255, 255, 255, 0.82) !important;
  border: 1px solid rgba(22, 22, 22, 0.1) !important;
  border-radius: var(--radius-md);
}

.mobile-menu-card .floating-menu-option:hover,
.mobile-menu-card .floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.1) !important;
  border-color: rgba(10, 91, 85, 0.24) !important;
}

.mobile-menu-card .floating-menu-option.is-active::after {
  background: var(--brand-red);
}

.view-tabs-row .view-tabs {
  margin-bottom: 0;
}

.view-tabs-row #newVideoButton {
  flex: 0 0 auto;
}

.new-video-tabs-slot {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  gap: 10px;
}

.new-video-board-inline-slot {
  display: inline-flex;
  align-items: center;
}

.calendar-top-nav {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-top-nav .mini-btn {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 12px;
}

#gridSortButton,
#boardMonthFilterButton {
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  color: var(--brand-ink);
  background: transparent;
  border: none;
  box-shadow: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 160ms ease, transform 160ms ease;
}

#gridSortButton svg,
#boardMonthFilterButton svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#gridSortButton.is-active,
#boardMonthFilterButton.is-active {
  background: transparent;
  color: var(--brand-red);
  border: none;
  box-shadow: none;
}

#gridSortButton:hover,
#gridSortButton:focus-visible,
#boardMonthFilterButton:hover,
#boardMonthFilterButton:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(22, 22, 22, 0.08);
}

#gridSortButton::after,
#boardMonthFilterButton::after {
  content: 'Sort by';
  position: absolute;
  right: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(50%) translateY(4px);
  background: rgba(22, 22, 22, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 8;
}

#boardMonthFilterButton::after {
  content: attr(data-tooltip);
}

#gridSortButton:hover::after,
#gridSortButton:focus-visible::after,
#boardMonthFilterButton:hover::after,
#boardMonthFilterButton:focus-visible::after {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.sort-filter-card {
  width: min(360px, calc(100vw - 24px));
}

.sort-status-block {
  display: grid;
  gap: 8px;
}

.sort-status-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.sort-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
}

.sort-status-item input {
  width: 16px;
  height: 16px;
}

.grid-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 8px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transform-origin: top left;
  transition: max-height 220ms var(--ease-soft), opacity 180ms ease, transform 220ms var(--ease-soft), padding 220ms var(--ease-soft);
}

.grid-filter-bar.is-open {
  max-height: 90px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  overflow: visible;
}

.grid-active-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 2px;
}
.grid-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(10,91,85,0.1);
  color: var(--brand-teal);
  border: 1px solid rgba(10,91,85,0.2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.grid-active-pill:hover { background: rgba(10,91,85,0.18); }
:root[data-theme='dark'] .grid-active-pill { background: rgba(99,212,204,0.12); color: #63d4cc; border-color: rgba(99,212,204,0.2); }

.grid-filter-clear-btn {
  margin-left: 0;
  background: transparent;
  border: none;
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 6px;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard);
}

.grid-filter-clear-btn:hover,
.grid-filter-clear-btn:focus-visible {
  color: #7b0b0b;
  background: rgba(99, 0, 0, 0.08);
}

.grid-filter-clear-btn.is-disabled {
  opacity: 0.45;
}

.grid-filter-close-btn {
  background: transparent;
  border: none;
  color: var(--brand-muted);
  font-size: 16px;
  font-weight: 700;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.9;
  transition: color 140ms ease, transform 160ms ease, opacity 140ms ease;
}

.grid-filter-close-btn:hover,
.grid-filter-close-btn:focus-visible {
  color: var(--brand-red);
  transform: translateY(-1px) scale(1.04);
  opacity: 1;
}

.grid-filter-btn {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: 999px;
  color: var(--brand-muted);
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
}

.grid-filter-btn:hover,
.grid-filter-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(22, 22, 22, 0.08);
  border-color: rgba(10, 91, 85, 0.24);
  background: rgba(255, 255, 255, 0.9);
}

.grid-filter-btn .grid-filter-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid-filter-btn .grid-filter-caret {
  font-size: 11px;
  line-height: 1;
  opacity: 0.8;
}

.grid-filter-btn.is-active {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.3);
  background: rgba(247, 214, 231, 0.35);
}

#gridTitleSortBtn[data-sort='desc'] .grid-filter-icon {
  transform: rotate(180deg);
}

#gridTitleSortMenu .floating-menu-card,
#gridApprovalMenu .floating-menu-card,
#gridStatusMenu .floating-menu-card,
#gridMonthMenu .floating-menu-card {
  min-width: 250px;
  max-width: 320px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.18);
}

#gridTitleSortMenu .floating-menu-head,
#gridApprovalMenu .floating-menu-head,
#gridStatusMenu .floating-menu-head,
#gridMonthMenu .floating-menu-head {
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

#gridTitleSortMenu .floating-menu-head p,
#gridApprovalMenu .floating-menu-head p,
#gridStatusMenu .floating-menu-head p,
#gridMonthMenu .floating-menu-head p {
  color: var(--brand-ink);
  font-size: 16px;
  font-weight: 700;
}

#gridTitleSortMenu .mini-btn,
#gridApprovalMenu .mini-btn,
#gridStatusMenu .mini-btn,
#gridMonthMenu .mini-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-muted);
  border-color: rgba(22, 22, 22, 0.14);
  padding: 2px 10px;
  min-height: 24px;
  font-size: 11px;
  font-weight: 600;
}

.grid-filter-menu-list {
  display: grid;
  gap: 6px;
}

#gridTitleSortMenu .floating-menu-option,
#gridApprovalMenu .sort-status-item,
#gridStatusMenu .sort-status-item,
#gridMonthMenu .floating-menu-option {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  color: var(--brand-ink);
}

#gridTitleSortMenu .floating-menu-option {
  justify-content: flex-start;
  padding: 8px 10px;
}

#gridTitleSortMenu .floating-menu-option:hover,
#gridTitleSortMenu .floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.08);
  border-color: rgba(10, 91, 85, 0.24);
}

.view-tab {
  background: rgba(255, 255, 255, 0.68);
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.08);
  padding: 10px 16px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.view-tab.is-active {
  background: linear-gradient(135deg, rgba(99, 0, 0, 0.96), rgba(74, 0, 0, 0.96));
  color: white;
}

.view-tab:hover:not(.is-active) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.9);
}

.view-panel { display: none; }
.view-panel.is-active { display: block; }
.view-panel.is-active.view-enter {
  animation: view-switch-in 180ms var(--ease-soft);
}

.view-panel.is-active .analytics-kpi,
.view-panel.is-active .analytics-chart-card,
.view-panel.is-active .analytics-table-wrap,
.view-panel.is-active .login-info-card,
.view-panel.is-active .profile-mention-item {
  animation: tfm-pop-in 220ms var(--ease-soft);
}

.view-panel.is-active .analytics-kpi:nth-child(2),
.view-panel.is-active .analytics-chart-card:nth-child(2),
.view-panel.is-active .login-info-card:nth-child(2) {
  animation-delay: 30ms;
}

.view-panel.is-active .analytics-kpi:nth-child(3),
.view-panel.is-active .analytics-chart-card:nth-child(3),
.view-panel.is-active .login-info-card:nth-child(3) {
  animation-delay: 60ms;
}

.admin-user-row,
.approved-email-card {
  animation: tfm-pop-in 200ms var(--ease-soft);
}

/* Prevent first-paint view flash by honoring the last stored view before JS hydration. */
html[data-initial-view='board'] body.is-booting #view-board,
html[data-initial-view='grid'] body.is-booting #view-grid,
html[data-initial-view='calendar'] body.is-booting #view-calendar,
html[data-initial-view='scripts'] body.is-booting #view-scripts,
html[data-initial-view='analytics'] body.is-booting #view-analytics,
html[data-initial-view='logins'] body.is-booting #view-logins {
  display: block;
}

html[data-initial-view='board'] body.is-booting .view-tab[data-view='board'],
html[data-initial-view='grid'] body.is-booting .view-tab[data-view='grid'],
html[data-initial-view='calendar'] body.is-booting .view-tab[data-view='calendar'],
html[data-initial-view='scripts'] body.is-booting .view-tab[data-view='scripts'],
html[data-initial-view='analytics'] body.is-booting .view-tab[data-view='analytics'],
html[data-initial-view='logins'] body.is-booting .view-tab[data-view='logins'] {
  background: linear-gradient(135deg, rgba(99, 0, 0, 0.96), rgba(74, 0, 0, 0.96));
  color: #fff;
  border-color: rgba(99, 0, 0, 0.42);
}

html[data-initial-view='scripts'] body.is-booting #newVideoButton,
html[data-initial-view='calendar'] body.is-booting #newVideoButton,
html[data-initial-view='analytics'] body.is-booting #newVideoButton,
html[data-initial-view='logins'] body.is-booting #newVideoButton {
  display: none;
}

.app-notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(460px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  box-shadow: 0 14px 28px rgba(22, 22, 22, 0.2);
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  pointer-events: none;
  transition: opacity 140ms ease, transform 180ms var(--ease-soft);
}

.app-notice.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.app-notice.is-error {
  border-color: rgba(99, 0, 0, 0.24);
}

.app-notice.is-success {
  border-color: rgba(10, 91, 85, 0.28);
}

#appNoticeText {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

#appNotice .mini-btn {
  padding: 4px 10px;
  min-height: 28px;
  font-size: 12px;
}

/* Smooth hydration so layout updates do not jump visually on refresh. */
body.is-booting .workspace-main {
  opacity: 0;
  transform: translateY(8px) scale(0.996);
}

body.is-booting .topbar-app,
body.is-booting .workspace-sidebar {
  opacity: 0;
  transform: translateY(8px) scale(0.996);
}

body.booted .workspace-main {
  opacity: 1;
  transform: none;
  transition: opacity 260ms var(--ease-soft), transform 340ms var(--ease-soft);
}

body.booted .topbar-app,
body.booted .workspace-sidebar {
  opacity: 1;
  transform: none;
  transition: opacity 260ms var(--ease-soft), transform 340ms var(--ease-soft);
}

body.booted .topbar-app {
  transition-delay: 40ms;
}

body.booted .workspace-sidebar {
  transition-delay: 90ms;
}

body.booted .workspace-main {
  transition-delay: 120ms;
}

@keyframes view-switch-in {
  from {
    opacity: 0.62;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scripts-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  min-height: 68vh;
  align-items: start;
}

.scripts-sidebar {
  border: 1px solid rgba(99, 0, 0, 0.14);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(255, 249, 227, 0.97));
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.scripts-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
  padding-bottom: 8px;
}

.scripts-sidebar-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scripts-sort-btn {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
}

.scripts-sort-btn.is-active {
  background: rgba(10, 91, 85, 0.12);
  border-color: rgba(10, 91, 85, 0.26);
  color: var(--brand-teal);
}

.scripts-sidebar-head .meta-label {
  color: var(--brand-ink);
  margin: 0;
}

.scripts-sidebar-toggle {
  display: none;
}

#scriptsAddDoc {
  background: transparent;
  border: 0;
  color: var(--brand-red);
  border-radius: 0;
  padding: 2px 4px;
  min-width: 0;
  min-height: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  box-shadow: none;
}

#scriptsAddDoc:hover,
#scriptsAddDoc:focus-visible {
  color: #870000;
  transform: translateY(-1px);
  box-shadow: none;
  background: transparent;
}

.scripts-tabs {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scripts-tabs::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.scripts-group {
  display: grid;
  gap: 4px;
}

.scripts-group-head {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 6px 3px;
}

.scripts-group-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.68);
  flex-shrink: 0;
}

.scripts-group-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(22, 22, 22, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scripts-tab {
  width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
  color: var(--brand-ink);
  padding: 8px 9px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  justify-content: flex-start;
  position: relative;
  padding-right: 10px;
  box-sizing: border-box;
  overflow: hidden;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.scripts-tab:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(10, 91, 85, 0.26);
  color: var(--brand-ink);
}

.scripts-tab.is-active {
  background: rgba(10, 91, 85, 0.11);
  border-color: rgba(10, 91, 85, 0.32);
  box-shadow: inset 2px 0 0 rgba(10, 91, 85, 0.9);
}

.scripts-tab-indented {
  margin-left: 14px;
  width: calc(100% - 14px);
}

.scripts-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.6);
  flex-shrink: 0;
}

.scripts-tab-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scripts-tab-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding-right: 0;
  transition: transform 170ms ease;
}

.scripts-tab.has-delete:hover .scripts-tab-right,
.scripts-tab.has-delete:focus-within .scripts-tab-right {
  transform: translateX(-24px);
}

.scripts-tab-right .status-chip {
  margin-left: 6px;
}

.scripts-status-dot-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
}

.scripts-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--scripts-status-dot, rgba(10, 91, 85, 0.7));
  box-shadow: 0 0 0 1px rgba(22, 22, 22, 0.12);
}

.scripts-status-dot-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  background: #fff9ea;
  border: 1px solid rgba(22, 22, 22, 0.14);
  border-radius: 8px;
  padding: 4px 7px;
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(22, 22, 22, 0.1);
  transition: opacity 120ms ease, transform 140ms ease;
  z-index: 8;
}

.scripts-status-dot-wrap[data-tooltip='']::after {
  display: none !important;
}

.scripts-status-dot-wrap:hover::after,
.scripts-status-dot-wrap:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.scripts-tab.is-editing {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(10, 91, 85, 0.32);
}

.scripts-tab-inline-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  padding: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 0;
}

.scripts-tab-inline-input:focus {
  outline: none;
}

.scripts-tab-delete {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  width: 20px;
  height: 20px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(22, 22, 22, 0.65);
  border-radius: 999px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 170ms ease, transform 170ms ease, color 140ms ease, background-color 140ms ease;
}

.scripts-tab-delete svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scripts-tab:hover .scripts-tab-delete,
.scripts-tab:focus-within .scripts-tab-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.scripts-tab-delete:hover,
.scripts-tab-delete:focus-visible {
  color: var(--brand-red);
  background: #fff;
  transform: translateY(-50%) scale(1.05);
}

#scriptsBackToScripts {
  min-height: 22px;
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 10px;
}

.scripts-editor-area {
  min-width: 0;
  overflow: auto;
  padding-right: 2px;
  display: grid;
  grid-template-columns: minmax(0, 840px) minmax(260px, 320px);
  gap: 14px;
  align-items: start;
  justify-content: start;
}

.scripts-doc-column {
  min-width: 0;
  width: min(840px, 100%);
  display: grid;
  align-content: start;
}

.scripts-toolbar {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 251, 255, 0.92));
  padding: 8px;
  margin: 0 0 12px;
  width: max-content;
  max-width: 100%;
  justify-self: start;
}

.scripts-format-btn {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(22, 22, 22, 0.12);
  color: var(--brand-ink);
  min-width: 32px;
  min-height: 32px;
  padding: 0 10px;
  font-weight: 700;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.scripts-format-btn:hover,
.scripts-format-btn:focus-visible {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.26);
}

.scripts-format-btn.is-active {
  background: rgba(10, 91, 85, 0.14);
  border-color: rgba(10, 91, 85, 0.34);
  color: #0a4e49;
}

.scripts-format-btn svg {
  display: block;
  flex-shrink: 0;
}

.scripts-heading-btn {
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.scripts-search-input {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--brand-ink);
  width: 140px;
  margin-left: 4px;
  min-height: 32px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.scripts-search-input::placeholder {
  color: var(--brand-muted);
}
.scripts-search-input:focus {
  outline: none;
  border-color: var(--brand-teal);
  background: var(--input-bg-strong);
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.15);
}
:root[data-theme='dark'] .scripts-search-input {
  background: rgba(255, 250, 217, 0.06);
  border-color: rgba(255, 250, 217, 0.12);
}
:root[data-theme='dark'] .scripts-search-input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(65, 163, 154, 0.2);
}

.scripts-size-select {
  width: 72px;
  min-width: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: var(--brand-ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
}

.scripts-size-select:focus {
  outline: 2px solid rgba(10, 91, 85, 0.22);
  border-color: var(--brand-teal);
}

.scripts-color-button {
  background: transparent;
  border: 1px solid rgba(22, 22, 22, 0.1);
  color: var(--brand-ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.scripts-color-button:hover,
.scripts-color-button:focus-visible {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.26);
}

.scripts-howto-button {
  background: transparent;
  border: 1px solid rgba(22, 22, 22, 0.1);
  color: var(--brand-ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.scripts-howto-button:hover,
.scripts-howto-button:focus-visible {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.26);
}

.scripts-month-filter-button {
  background: transparent;
  border: 1px solid rgba(22, 22, 22, 0.1);
  color: var(--brand-ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.scripts-month-filter-button:hover,
.scripts-month-filter-button:focus-visible {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.26);
}

.scripts-month-filter-button.is-active {
  background: rgba(10, 91, 85, 0.14);
  border-color: rgba(10, 91, 85, 0.34);
  color: #0a4e49;
}

.scripts-color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #161616;
  border: 1px solid rgba(22, 22, 22, 0.2);
  flex-shrink: 0;
}

.scripts-paper {
  width: min(840px, 100%);
  min-height: 1040px;
  margin: 0;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.99);
  padding: 42px 52px;
  box-shadow: 0 16px 28px rgba(22, 22, 22, 0.08);
}

.scripts-comments-rail {
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 248, 239, 0.95));
  padding: 10px;
  max-height: none;
  overflow: visible;
  position: static;
  margin-top: 54px;
  width: 100%;
}

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

.scripts-comments-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.scripts-comments-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.14);
  color: var(--brand-teal);
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

.scripts-comments-list {
  display: grid;
  gap: 8px;
}

.scripts-comments-empty {
  margin: 0;
  color: var(--brand-muted);
  font-size: 12px;
}

.script-comment-card {
  border: 1px solid rgba(22, 22, 22, 0.09);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.86);
  padding: 9px;
  display: grid;
  gap: 7px;
  transition: border-color 140ms ease, box-shadow 160ms ease, transform 140ms ease;
}

.script-comment-card.is-active {
  border-color: rgba(10, 91, 85, 0.3);
  box-shadow: 0 10px 18px rgba(10, 91, 85, 0.15);
  transform: translateY(-1px);
}

.script-comment-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.script-comment-author-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.script-comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.18);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.script-comment-author {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
}

.script-comment-date {
  display: block;
  font-size: 11px;
  color: var(--brand-muted);
}

.script-comment-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.script-comment-resolve,
.script-comment-menu-toggle {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(22, 22, 22, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: rgba(22, 22, 22, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.script-comment-resolve svg,
.script-comment-menu-toggle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.script-comment-menu-toggle svg {
  fill: currentColor;
  stroke: none;
}

.script-comment-resolve:hover,
.script-comment-resolve:focus-visible {
  color: #26754b;
  border-color: rgba(38, 117, 75, 0.34);
}

.script-comment-menu-toggle:hover,
.script-comment-menu-toggle:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.28);
}

.script-comment-menu-wrap {
  position: relative;
}

.script-comment-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 110px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 24px rgba(22, 22, 22, 0.18);
  overflow: hidden;
  z-index: 12;
}

.script-comment-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-ink);
}

.script-comment-menu button:hover,
.script-comment-menu button:focus-visible {
  background: rgba(10, 91, 85, 0.12);
}

.script-comment-body {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.script-comment-edit {
  display: grid;
  gap: 7px;
}

.script-comment-edit textarea {
  min-height: 64px;
  resize: vertical;
  font-size: 12px;
}

.script-comment-edit-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
}

.script-highlight-span {
  background: rgba(10, 91, 85, 0.2);
  border-radius: 2px;
  transition: background-color 130ms ease, box-shadow 160ms ease;
}

.script-highlight-span.is-active {
  background: rgba(10, 91, 85, 0.34);
  box-shadow: inset 0 -1px 0 rgba(7, 64, 60, 0.32), 0 1px 3px rgba(22, 22, 22, 0.12);
}

.script-selection-comment-btn {
  position: fixed;
  z-index: 260;
  border: 1px solid rgba(22, 22, 22, 0.14);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--brand-ink);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 14px;
  min-height: 40px;
  box-shadow: 0 10px 24px rgba(22, 22, 22, 0.22);
  transition: transform 160ms var(--ease-soft), opacity 130ms ease;
}

.script-selection-comment-btn:hover,
.script-selection-comment-btn:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.32);
}

#scriptCommentComposer {
  z-index: 270;
}

.script-comment-composer-card {
  width: min(340px, calc(100vw - 24px));
  max-width: min(340px, calc(100vw - 24px));
  padding: 10px;
  border-radius: var(--radius-md);
}

.script-comment-composer-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.script-comment-composer-author {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.script-comment-composer-selection {
  display: block;
  font-size: 11px;
  color: var(--brand-muted);
  line-height: 1.25;
  max-height: 32px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.script-comment-composer-card textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-size: 13px;
  margin-bottom: 8px;
}

.script-comment-composer-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
}

.panel-lite {
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 252, 237, 0.96));
  padding: 12px;
}

.analytics-summary {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  padding-bottom: 0;
}

.analytics-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 12px;
  padding: 2px;
  border-radius: 12px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: #f6efd4;
}

.analytics-tab-btn {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 9px;
  border-color: transparent;
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.analytics-tab-btn:hover:not(.is-active) {
  background: rgba(99, 0, 0, 0.06);
  color: var(--brand-red);
}

.analytics-tab-btn.is-active {
  background: linear-gradient(135deg, rgba(99, 0, 0, 0.96), rgba(74, 0, 0, 0.96));
  color: #fff;
  border-color: rgba(99, 0, 0, 0.45);
  box-shadow: none;
}

.analytics-month-filter-button {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(22, 22, 22, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.analytics-month-filter-button.is-active {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.35);
  color: var(--brand-teal);
}

.analytics-month-filter-card {
  width: min(260px, calc(100vw - 20px));
}

.analytics-month-filter-list {
  max-height: 280px;
  overflow-y: auto;
}

.analytics-month-filter-list .floating-menu-option {
  justify-content: flex-start;
}

.analytics-month-filter-list .floating-menu-option .tag-chip {
  max-width: 100%;
}

.analytics-month-option-label {
  font-weight: 700;
  color: var(--brand-ink);
}

.analytics-kpi {
  border: 1px solid rgba(22, 22, 22, 0.09);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  padding: 8px;
  display: grid;
  gap: 4px;
  min-width: 0;
  position: relative;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.analytics-kpi:hover {
  border-color: rgba(22, 22, 22, 0.16);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(22, 22, 22, 0.06);
}

.analytics-summary .analytics-kpi {
  width: max-content;
  min-width: 140px;
  max-width: 100%;
  flex: 0 1 auto;
}

.analytics-kpi p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 12px;
}

.analytics-kpi-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  position: relative;
}

.analytics-kpi-info {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(22, 22, 22, 0.2);
  background: rgba(255, 255, 255, 0.95);
  color: rgba(22, 22, 22, 0.78);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, visibility 120ms ease, transform 140ms ease;
  transform: translateY(1px);
}

.analytics-kpi-tooltip {
  display: none;
}

.analytics-kpi:first-child .analytics-kpi-tooltip,
.analytics-kpi:nth-child(2) .analytics-kpi-tooltip {
  left: 0;
  right: auto;
}

.analytics-kpi:hover .analytics-kpi-info,
.analytics-kpi:focus-within .analytics-kpi-info,
.analytics-kpi-info:focus-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.analytics-kpi-spark {
  width: 100%;
  height: 22px;
  margin-top: 2px;
  color: var(--brand-muted);
  opacity: 0.55;
  pointer-events: none;
}
.analytics-kpi-spark[data-trend="up"] { color: #16a34a; opacity: 0.75; }
.analytics-kpi-spark[data-trend="down"] { color: #dc2626; opacity: 0.75; }
[data-theme="dark"] .analytics-kpi-spark { opacity: 0.7; }
[data-theme="dark"] .analytics-kpi-spark[data-trend="up"] { color: #4ade80; }
[data-theme="dark"] .analytics-kpi-spark[data-trend="down"] { color: #f87171; }

.analytics-last-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--brand-muted);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(22,22,22,0.04);
  border: 1px solid rgba(22,22,22,0.08);
}
.analytics-last-updated .analytics-refresh-btn {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--brand-teal);
  cursor: pointer;
}
.analytics-last-updated .analytics-refresh-btn:hover { text-decoration: underline; }
[data-theme="dark"] .analytics-last-updated {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

/* Refreshing indicator — replaces the Refresh button visually for the
   duration of a sync. Pulsing teal dot + label is enough to signal
   "something is happening" without competing with the chart animations. */
.analytics-refreshing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-teal);
  font-weight: 500;
}
.analytics-refreshing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-teal);
  animation: analytics-refreshing-pulse 1s ease-in-out infinite;
}
@keyframes analytics-refreshing-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}

.analytics-kpi-info:hover + .analytics-kpi-tooltip,
.analytics-kpi-info:focus-visible + .analytics-kpi-tooltip,
.analytics-kpi:hover .analytics-kpi-tooltip,
.analytics-kpi:focus-within .analytics-kpi-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.analytics-global-tooltip {
  position: fixed;
  z-index: 12000;
  width: auto;
  max-width: min(380px, calc(100vw - 20px));
  border: 1px solid rgba(22, 22, 22, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.995);
  color: var(--brand-ink);
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.38;
  white-space: normal;
  overflow-wrap: break-word;
  box-shadow: 0 3px 10px rgba(22, 22, 22, 0.12);
  pointer-events: none;
}

.analytics-kpi strong {
  font-size: clamp(16px, 4.6vw, 30px);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

@media (max-width: 960px) {
  .analytics-summary {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .analytics-summary .analytics-kpi {
    min-width: 172px;
    flex: 0 0 auto;
  }
}

@media (max-width: 600px) {
  /* Wrap KPI cards into a 2-column grid instead of horizontal scroll */
  .analytics-summary {
    flex-wrap: wrap;
    overflow-x: hidden;
    gap: 8px;
  }

  .analytics-summary .analytics-kpi {
    flex: 1 1 calc(50% - 4px);
    min-width: calc(50% - 4px);
  }

  /* Make analytics tabs scroll rather than overflow */
  .analytics-tabs {
    display: flex;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: var(--radius-md);
  }

  .analytics-tabs::-webkit-scrollbar {
    display: none;
  }

  .analytics-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.analytics-kpi.is-change strong {
  color: var(--brand-teal);
}

.analytics-kpi.is-change.is-negative strong {
  color: #9d1c1c;
}

.analytics-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.analytics-chart-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.analytics-chart {
  min-height: 170px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  padding-right: 4px;
}

.analytics-bars {
  height: 170px;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: end;
  min-width: 100%;
  padding-right: 12px;
  box-sizing: border-box;
}

.analytics-bar-wrap {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  height: 100%;
  min-height: 0;
  align-items: end;
  width: 92px;
  min-width: 92px;
}

.analytics-bar {
  width: 100%;
  border-radius: 8px 8px 4px 4px;
  min-height: 8px;
  max-height: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 6px;
  overflow: hidden;
}

.analytics-bar.is-zero {
  min-height: 16px;
  padding: 0 6px;
  border: 1px solid rgba(22, 22, 22, 0.16);
}

#analyticsDateMenu {
  z-index: 230;
}

.analytics-bar.is-engagement {
  background: linear-gradient(180deg, rgba(10, 91, 85, 0.95), rgba(10, 91, 85, 0.65));
}

.analytics-bar.is-reach {
  background: linear-gradient(180deg, rgba(99, 0, 0, 0.95), rgba(99, 0, 0, 0.62));
}

.analytics-bar.is-followers {
  background: linear-gradient(180deg, rgba(78, 132, 92, 0.95), rgba(78, 132, 92, 0.62));
}

.analytics-bar.is-videos {
  background: linear-gradient(180deg, rgba(115, 94, 173, 0.95), rgba(115, 94, 173, 0.62));
}

.analytics-bar.is-adspend {
  background: linear-gradient(180deg, rgba(180, 108, 29, 0.95), rgba(180, 108, 29, 0.62));
}

.analytics-bar-label {
  font-size: 10px;
  color: var(--brand-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
  min-height: 24px;
  text-align: center;
  overflow-wrap: anywhere;
}

.analytics-bar-value {
  font-size: 10px;
  font-weight: 700;
  color: #fffad9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.analytics-bar.is-zero .analytics-bar-value {
  color: #fffad9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.analytics-bar.is-engagement.is-zero {
  background: rgba(10, 91, 85, 0.58);
}

.analytics-bar.is-reach.is-zero {
  background: rgba(99, 0, 0, 0.58);
}

.analytics-bar.is-followers.is-zero {
  background: rgba(78, 132, 92, 0.58);
}

.analytics-bar.is-videos.is-zero {
  background: rgba(115, 94, 173, 0.58);
}

.analytics-bar.is-adspend.is-zero {
  background: rgba(180, 108, 29, 0.58);
}

.analytics-table-wrap {
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fffdf4;
}

.attribution-panel {
  margin-bottom: 12px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 0;
  background: #fffdf4;
}

.attribution-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.attribution-summary {
  padding: 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.1);
}

.attribution-summary .attribution-kpi {
  min-width: 132px;
}

.attribution-table-wrap {
  border: 0;
  border-radius: 0;
  overflow-x: auto;
}

.attribution-table th,
.attribution-table td {
  font-size: 11px;
  padding: 7px;
}

.attribution-table {
  min-width: 1080px;
}

.attribution-currency-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attribution-currency-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--brand-muted);
}

.attribution-currency-btns {
  display: flex;
  border: 1px solid rgba(22, 22, 22, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

.attribution-curr-btn {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--brand-muted);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.attribution-curr-btn.is-active {
  background: var(--brand-red);
  color: #fff;
}

.attribution-curr-btn:not(.is-active):hover {
  background: rgba(22, 22, 22, 0.06);
}

.attribution-rate-hint {
  font-size: 10px;
  color: var(--brand-muted);
  opacity: 0.7;
}

.attribution-currency-cell {
  cursor: text;
}

.ac-display {
  display: block;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-ink);
  min-height: 30px;
  line-height: 20px;
}

.ac-input {
  display: none;
  width: 100%;
}

.attribution-currency-cell.is-editing .ac-display {
  display: none;
}

.attribution-currency-cell.is-editing .ac-input {
  display: block;
}

.attribution-table input,
.attribution-table select {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.attribution-delete {
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 9px;
}

.attribution-submit-shell {
  max-width: 860px;
}

.attribution-submit-panel {
  padding: 20px;
}

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

.attribution-submit-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--brand-muted);
}

.analytics-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.12);
  background: #f6efd4;
}

.analytics-table-head h4 {
  margin: 0;
  font-size: 14px;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
  border-top: 1px solid rgba(22, 22, 22, 0.09);
  padding: 8px;
  text-align: left;
  font-size: 12px;
}

.analytics-table th {
  background: #f6efd4;
  color: var(--brand-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  border-top: 0;
}

.analytics-table td {
  background: #fffdf8;
}

.analytics-actions-head {
  width: 46px;
  min-width: 46px;
  padding: 0;
  background: rgba(255, 248, 218, 0.88);
}

.analytics-table input {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.analytics-table input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.analytics-table input[type='number']::-webkit-outer-spin-button,
.analytics-table input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.analytics-table input.is-filled,
.analytics-date-btn.is-filled {
  font-weight: 700;
}

.analytics-table input:hover,
.analytics-table input:focus {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(22, 22, 22, 0.16);
}

.analytics-table input:not(:focus):not(:hover) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.analytics-row-actions-cell {
  width: 46px;
  min-width: 46px;
  text-align: right;
  padding-right: 8px;
}

.analytics-week-delete {
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 12px;
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(6px);
  transition: opacity 140ms ease, transform 170ms var(--ease-soft), color 120ms ease, border-color 120ms ease;
}

.analytics-week-delete svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.analytics-row:hover .analytics-week-delete,
.analytics-row:focus-within .analytics-week-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.analytics-week-delete:hover {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.32);
}

.analytics-date-btn {
  width: 100%;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.analytics-date-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(10, 91, 85, 0.45);
}

.date-menu-topline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.date-range-sep {
  font-size: 12px;
  color: var(--brand-muted);
}

.date-menu-topline .date-input {
  width: 100%;
  min-height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 8px;
  color: var(--brand-ink);
  font-weight: 700;
}

.date-menu-nav {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.date-menu-nav p {
  margin: 0;
  font-weight: 800;
}

.date-menu-day.is-range-day {
  background: rgba(10, 91, 85, 0.12);
  border-color: rgba(10, 91, 85, 0.25);
}

.analytics-change {
  font-weight: 700;
  font-size: 12px;
}

.analytics-change.is-positive {
  color: var(--brand-teal);
}

.analytics-change.is-negative {
  color: var(--brand-red);
}

.login-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 360px));
  gap: 10px;
  align-items: stretch;
  justify-content: start;
}

.login-info-card {
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  padding: 9px;
  display: grid;
  gap: 6px;
  min-height: 152px;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.login-info-card:hover {
  border-color: rgba(22, 22, 22, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px rgba(22, 22, 22, 0.06);
}

.login-info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}

.login-platform-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--brand-ink);
}

.login-info-delete {
  min-width: 28px;
  min-height: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity 140ms ease, transform 170ms var(--ease-soft), color 120ms ease, border-color 120ms ease;
}

.login-info-delete svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-info-card:hover .login-info-delete,
.login-info-card:focus-within .login-info-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.login-info-delete:hover,
.login-info-delete:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.3);
}

.login-platform-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.login-field {
  display: grid;
  gap: 4px;
}

.login-info-card label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-muted);
  letter-spacing: 0.01em;
}

.login-info-card input {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

.login-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-pw-wrap .login-pw-input {
  flex: 1;
  padding-right: 36px !important;
}
.login-pw-eye {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--brand-muted);
  display: flex;
  align-items: center;
}
.login-pw-eye svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.login-pw-eye:hover { color: var(--brand-teal); }
.login-pw-strength {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-pw-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(22,22,22,0.1);
  overflow: hidden;
}
.login-pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.2s, background 0.2s;
}
.login-pw-strength-label { white-space: nowrap; }

.login-info-add-card {
  width: 360px;
  min-height: 152px;
  border-style: dashed;
  border-color: rgba(10, 91, 85, 0.28);
  background: rgba(10, 91, 85, 0.015);
  color: var(--brand-teal);
  display: grid;
  place-content: center;
  gap: 6px;
  justify-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 180ms var(--ease-soft), transform 180ms var(--ease-soft), background 180ms var(--ease-soft), border-color 180ms var(--ease-soft);
}

#view-logins:hover .login-info-add-card,
#view-logins:focus-within .login-info-add-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.login-info-add-card:hover,
.login-info-add-card:focus-visible {
  border-color: rgba(10, 91, 85, 0.48);
  background: rgba(10, 91, 85, 0.045);
  transform: translateY(-1px);
}

.login-info-add-plus {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(10, 91, 85, 0.34);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  transition: transform 180ms var(--ease-soft), background 180ms var(--ease-soft), color 180ms var(--ease-soft);
}

.login-info-add-text {
  font-size: 17px;
  font-weight: 700;
  opacity: 1;
  transform: none;
  transition: color 180ms var(--ease-soft);
}

.login-info-add-card:hover .login-info-add-plus,
.login-info-add-card:focus-visible .login-info-add-plus {
  transform: translateY(-1px);
  background: rgba(10, 91, 85, 0.12);
}

.login-info-add-card:focus-visible .login-info-add-text,
.login-info-add-card:hover .login-info-add-text { color: #07524c; }

@media (max-width: 900px) {
  .login-info-add-card {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    border-color: rgba(10, 91, 85, 0.3);
  }

  .login-platform-fields {
    grid-template-columns: 1fr;
  }
}

.scripts-doc-title-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.12);
  margin-bottom: 18px;
  padding-bottom: 10px;
}

.scripts-doc-title-row .scripts-doc-title-input {
  flex: 1 1 auto;
  border: 0;
  border-bottom: 0;
  margin-bottom: 0;
  padding: 0;
}

.scripts-save-status {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  color: rgba(22, 22, 22, 0.55);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
.scripts-save-status.saved { color: #0a5b55; background: rgba(10, 91, 85, 0.09); }
.scripts-save-status.saving { color: #555; background: rgba(22, 22, 22, 0.06); }
.scripts-save-status.pending { color: #8a5a00; background: rgba(255, 180, 0, 0.14); }
.scripts-save-status.error {
  color: #8a1f12;
  background: rgba(255, 60, 40, 0.14);
  box-shadow: inset 0 0 0 1px rgba(138, 31, 18, 0.3);
}
:root[data-theme='dark'] .scripts-save-status { color: rgba(235, 235, 235, 0.6); }
:root[data-theme='dark'] .scripts-save-status.saved { color: #6fd7cd; background: rgba(111, 215, 205, 0.12); }
:root[data-theme='dark'] .scripts-save-status.saving { color: #ccc; background: rgba(255, 255, 255, 0.08); }
:root[data-theme='dark'] .scripts-save-status.pending { color: #ffc66a; background: rgba(255, 198, 106, 0.14); }
:root[data-theme='dark'] .scripts-save-status.error { color: #ff8a7a; background: rgba(255, 80, 60, 0.18); }

/* Global save status pill — sits next to workspace title */
.global-save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  user-select: none;
  margin-left: 10px;
  vertical-align: middle;
  transition: background 0.15s ease, color 0.15s ease;
  align-self: center;
  flex: 0 0 auto;
}
.global-save-status .gss-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.global-save-status[data-state="saved"] {
  color: #0a5b55;
  background: rgba(10, 91, 85, 0.10);
}
.global-save-status[data-state="saved"] .gss-icon {
  background: #21b486;
  box-shadow: 0 0 0 3px rgba(33, 180, 134, 0.18);
}
.global-save-status[data-state="saving"] {
  color: #555;
  background: rgba(22, 22, 22, 0.06);
}
.global-save-status[data-state="saving"] .gss-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(22, 22, 22, 0.18);
  border-top-color: #0a5b55;
  background: transparent;
  box-shadow: none;
  animation: gss-spin 0.8s linear infinite;
}
.global-save-status[data-state="error"] {
  color: #8a1f12;
  background: rgba(255, 60, 40, 0.14);
  box-shadow: inset 0 0 0 1px rgba(138, 31, 18, 0.3);
  cursor: pointer;
}
.global-save-status[data-state="error"] .gss-icon {
  background: #d94a3a;
  box-shadow: 0 0 0 3px rgba(217, 74, 58, 0.22);
}
@keyframes gss-spin {
  to { transform: rotate(360deg); }
}
:root[data-theme='dark'] .global-save-status[data-state="saved"] {
  color: #6fd7cd;
  background: rgba(111, 215, 205, 0.12);
}
:root[data-theme='dark'] .global-save-status[data-state="saved"] .gss-icon {
  background: #38d9a9;
  box-shadow: 0 0 0 3px rgba(56, 217, 169, 0.20);
}
:root[data-theme='dark'] .global-save-status[data-state="saving"] {
  color: #ccc;
  background: rgba(255, 255, 255, 0.08);
}
:root[data-theme='dark'] .global-save-status[data-state="saving"] .gss-icon {
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: #6fd7cd;
}
:root[data-theme='dark'] .global-save-status[data-state="error"] {
  color: #ff8a7a;
  background: rgba(255, 80, 60, 0.18);
}

.scripts-doc-title-input {
  border: 0;
  border-bottom: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: 0;
  background: transparent;
  margin-bottom: 18px;
  padding: 0 0 10px;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.scripts-doc-title-input:focus {
  outline: none;
  border-color: rgba(10, 91, 85, 0.44);
}

.scripts-doc-body {
  min-height: 820px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--brand-ink);
  outline: none;
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 400;
}

.scripts-doc-body h1,
.scripts-doc-body h2,
.scripts-doc-body h3 {
  margin: 20px 0 10px;
  line-height: 1.25;
}

.scripts-doc-body p {
  margin: 0 0 14px;
}

.scripts-word-count {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 4px;
  border-top: 1px solid rgba(22,22,22,0.07);
  margin-top: 16px;
  font-size: 12px;
  color: var(--brand-muted);
}
.scripts-word-count-sep { opacity: 0.4; }
:root[data-theme='dark'] .scripts-word-count { border-color: rgba(255,255,255,0.08); }

.board-helper-copy {
  margin: 0;
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2,
.drawer-head h2,
.comments-block h3 {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.compact-head {
  align-items: center;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form input {
  min-width: 260px;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 272px;
  align-items: start;
  gap: 14px;
  overflow-x: auto;
  padding: 18px 18px 6px 0;
  margin-top: -18px;
  scroll-padding-right: 18px;
  width: auto;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.board::-webkit-scrollbar {
  display: none;
}

.board-column {
  min-height: 0;
  background: rgba(255, 251, 234, 0.92);
  border: 1px solid rgba(22, 22, 22, 0.07);
  border-radius: var(--radius-xl);
  padding: 6px 6px 4px;
  overflow: visible;
}

.board-column[data-status='idea'] {
  background: rgba(231, 224, 210, 0.28);
  border-color: rgba(94, 83, 64, 0.18);
}

.board-column[data-status='script'] {
  background: rgba(216, 229, 246, 0.3);
  border-color: rgba(51, 93, 150, 0.2);
}

.board-column[data-status='filmed'] {
  background: rgba(245, 225, 168, 0.28);
  border-color: rgba(140, 102, 17, 0.2);
}

.board-column[data-status='editing'] {
  background: rgba(243, 220, 198, 0.28);
  border-color: rgba(164, 96, 34, 0.2);
}

.board-column[data-status='awaiting_approval'] {
  background: rgba(235, 221, 246, 0.3);
  border-color: rgba(127, 73, 171, 0.2);
}

.board-column[data-status='approved'] {
  background: rgba(210, 234, 215, 0.3);
  border-color: rgba(38, 117, 75, 0.2);
}

.board-column[data-status='scheduled'] {
  background: rgba(247, 214, 231, 0.32);
  border-color: rgba(163, 62, 116, 0.2);
}

.board-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 2px 8px;
}

.column-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.board-hover-peek {
  position: fixed;
  z-index: 999;
  background: var(--brand-surface, #fff);
  border: 1px solid rgba(22,22,22,0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 10px 14px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
:root[data-theme='dark'] .board-hover-peek {
  background: #1e1e1e;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.board-column-collapse-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--brand-muted);
  display: inline-flex;
  align-items: center;
  border-radius: 3px;
  flex-shrink: 0;
}
.board-column-collapse-btn:hover { background: rgba(22,22,22,0.06); color: var(--brand-text); }
.board-column.is-collapsed .dropzone { display: none; }
.board-column.is-collapsed { min-width: 44px; width: 44px; }
.board-column.is-collapsed .board-column-head { flex-direction: column; gap: 6px; }
.board-column.is-collapsed .column-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 11px;
}
.board-column.is-collapsed .column-divider,
.board-column.is-collapsed .column-count,
.board-column.is-collapsed .board-column-plus { display: none; }

.board-column-plus {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--brand-red);
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-1px);
  transition: opacity 150ms ease, background-color 150ms ease;
  z-index: 5;
}

.board-column-plus::after {
  content: 'New video';
  position: absolute;
  right: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(50%) translateY(4px);
  background: rgba(22, 22, 22, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 8;
}

.board-column:hover .board-column-plus,
.board-column:focus-within .board-column-plus {
  opacity: 1;
  pointer-events: auto;
}

.board-column-plus:hover {
  background: rgba(99, 0, 0, 0.08);
}

.board-column-plus:hover::after,
.board-column-plus:focus-visible::after {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.column-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-red);
  font-weight: 700;
}

.column-divider {
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.column-count {
  font-size: 13px;
  color: var(--brand-red);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.dropzone {
  min-height: 0;
  padding-bottom: 0;
}

.board-drop-indicator {
  height: 4px;
  border-radius: 999px;
  background: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.18);
  margin: 4px 2px;
}

.board-drop-indicator.is-end {
  margin-top: 2px;
  margin-bottom: 10px;
}

.board-column.is-drop-target {
  box-shadow: inset 0 0 0 1px rgba(10, 91, 85, 0.26);
}

.board-add {
  width: 100%;
  margin-top: 0;
  background: rgba(10, 91, 85, 0.08);
  color: var(--brand-teal);
  border: 1px dashed transparent;
  border-radius: var(--radius-md);
  padding: 0 10px;
  max-height: 0;
  justify-content: flex-start;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition: max-height 220ms ease, padding 220ms ease, margin-top 220ms ease, opacity 180ms ease, transform 220ms ease, border-color 220ms ease;
}

.board-column:hover .board-add {
  max-height: 44px;
  margin-top: 8px;
  padding: 8px 10px;
  border-color: rgba(10, 91, 85, 0.24);
  opacity: 1;
  transform: translateY(0);
}

.video-card {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: grab;
  position: relative;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.video-card.is-drag-source {
  opacity: 0.35;
  transform: none !important;
}

.board-drag-ghost {
  position: fixed;
  top: -9999px;
  left: -9999px;
  pointer-events: none;
  opacity: 0.7;
  transform: rotate(-1deg);
  box-shadow: 0 14px 24px rgba(22, 22, 22, 0.2);
}

.board-column[data-status='idea'] .video-card {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(94, 83, 64, 0.16);
}

.board-column[data-status='script'] .video-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(51, 93, 150, 0.16);
}

.board-column[data-status='filmed'] .video-card {
  background: rgba(255, 255, 255, 0.73);
  border-color: rgba(140, 102, 17, 0.15);
}

.board-column[data-status='editing'] .video-card {
  background: rgba(255, 255, 255, 0.73);
  border-color: rgba(164, 96, 34, 0.15);
}

.board-column[data-status='awaiting_approval'] .video-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(127, 73, 171, 0.16);
}

.board-column[data-status='approved'] .video-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(38, 117, 75, 0.16);
}

.board-column[data-status='scheduled'] .video-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(163, 62, 116, 0.16);
}

.video-card-status {
  margin-top: 6px;
}

.board-month-trigger {
  border: 0;
  background: transparent;
  color: var(--brand-muted);
  padding: 0;
  font-size: 11px;
  font-weight: 500;
  border-radius: 0;
  justify-content: flex-start;
}

.board-month-trigger:hover {
  text-decoration: none;
}

.board-month-trigger:hover .tag-chip {
  filter: brightness(0.98);
  transform: translateX(1px);
}

.board-month-trigger .tag-chip {
  font-size: 10px;
  padding: 2px 7px;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.board-chip-trigger {
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  justify-content: flex-start;
}

.board-chip-trigger:hover .status-chip {
  filter: brightness(0.98);
}

.video-card:hover,
.grid-row:hover,
.calendar-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(22, 22, 22, 0.08);
}

.video-card h3 {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.34;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.video-title-trigger {
  margin-top: 8px;
  width: 100%;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--brand-ink);
  padding: 0;
  border-radius: 0;
  font-size: 15px;
  line-height: 1.34;
  letter-spacing: -0.01em;
  font-weight: 700;
  transition: color 160ms ease, transform 160ms ease;
}

.video-title-trigger:hover {
  color: var(--brand-red);
  transform: translateX(2px);
}

.video-title-trigger.is-placeholder,
.video-title-static.is-placeholder {
  color: rgba(22, 22, 22, 0.42);
  font-weight: 600;
}

.video-title-trigger.is-placeholder:hover {
  color: rgba(22, 22, 22, 0.5);
  transform: none;
}

.video-title-static {
  margin-top: 8px;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}

.board-inline-title-edit {
  margin-top: 8px;
  width: calc(100% - 86px);
  max-width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-ink);
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.34;
  font-weight: 500;
}

.video-card-top,
.video-card-footer,
.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.video-card-top {
  position: absolute;
  top: 8px;
  right: 8px;
  justify-content: flex-end;
  z-index: 2;
}

.video-card-footer {
  margin-top: 8px;
  font-size: 10px;
  color: var(--brand-muted);
}

.video-card-footer.has-scheduled-date {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0;
}

.video-scheduled-date {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 11px;
  color: var(--brand-muted);
}

.video-card-footer.has-scheduled-date .video-comments-indicator {
  display: none;
}

.video-comments-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-muted);
  margin-left: 2px;
}

:root[data-theme='dark'] .video-comments-indicator {
  color: #aaa;
}

.video-comments-indicator svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.video-comments-indicator.is-empty {
  visibility: hidden;
}

.video-publish-date.is-empty {
  display: none;
}

.video-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.video-card-open,
.video-card-copy-link,
.video-card-delete {
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(22, 22, 22, 0.12);
  background: #fff;
  color: var(--brand-muted);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-mid) var(--ease-soft);
  box-shadow: 0 1px 0 rgba(22, 22, 22, 0.06);
  transform: translateY(-2px);
}

.video-card-copy-link,
.video-card-delete {
  width: 28px;
  height: 28px;
  padding: 0;
}

.video-card-copy-link svg,
.video-card-delete svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.video-card-copy-link.copy-link-copied {
  color: var(--brand-teal);
  border-color: rgba(10, 91, 85, 0.32);
  background: rgba(255, 255, 255, 1);
}

.video-card-copy-link:hover,
.video-card-copy-link:focus-visible {
  color: var(--brand-teal);
  border-color: rgba(10, 91, 85, 0.32);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 10px rgba(10, 91, 85, 0.12);
}

.video-card:hover .video-card-open,
.video-card:hover .video-card-copy-link,
.video-card:hover .video-card-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.video-card-open:hover,
.video-card-open:focus-visible,
.grid-row-open:hover,
.grid-row-open:focus-visible,
.open-hover-btn:hover,
.open-hover-btn:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.32);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 10px rgba(99, 0, 0, 0.12);
}

:root[data-theme='dark'] .video-card-open,
:root[data-theme='dark'] .video-card-copy-link,
:root[data-theme='dark'] .video-card-delete {
  background: rgba(50, 50, 50, 1);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 245, 220, 0.85);
}

:root[data-theme='dark'] .video-card-open:hover,
:root[data-theme='dark'] .video-card-open:focus-visible,
:root[data-theme='dark'] .grid-row-open:hover,
:root[data-theme='dark'] .grid-row-open:focus-visible,
:root[data-theme='dark'] .open-hover-btn:hover,
:root[data-theme='dark'] .open-hover-btn:focus-visible {
  background: rgba(60, 60, 60, 1);
  border-color: rgba(201, 90, 90, 0.5);
  color: #fff5dc;
  box-shadow: 0 3px 10px rgba(201, 90, 90, 0.2);
}

:root[data-theme='dark'] .video-card-copy-link:hover,
:root[data-theme='dark'] .video-card-copy-link:focus-visible {
  background: rgba(60, 60, 60, 1);
  border-color: rgba(10, 91, 85, 0.5);
  color: var(--brand-teal);
  box-shadow: 0 3px 10px rgba(10, 91, 85, 0.2);
}

:root[data-theme='dark'] .video-card-delete:hover,
:root[data-theme='dark'] .video-card-delete:focus-visible,
:root[data-theme='dark'] .grid-row-delete:hover,
:root[data-theme='dark'] .grid-row-delete:focus-visible {
  background: rgba(60, 60, 60, 1);
  border-color: rgba(201, 90, 90, 0.5);
  color: #e06060;
  box-shadow: 0 3px 10px rgba(201, 90, 90, 0.2);
}

.video-card-delete:hover,
.video-card-delete:focus-visible,
.grid-row-delete:hover,
.grid-row-delete:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.32);
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 3px 10px rgba(99, 0, 0, 0.12);
}

.video-meta-line {
  margin-top: 6px;
  color: var(--brand-muted);
  font-size: 11px;
}

.board-inline-pillar-placeholder {
  color: var(--brand-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board .status-chip {
  font-size: 11px;
  padding: 3px 8px;
}

.board-inline-editor {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.board-inline-title,
.board-inline-month {
  width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-ink);
  padding: 8px 10px;
  font-size: 13px;
}

.board-inline-title-new {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 15px;
  line-height: 1.34;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: none;
}

.board-inline-title-new:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.board-inline-title-new::placeholder {
  color: rgba(22, 22, 22, 0.45);
  font-weight: 600;
}

.video-meta-trigger {
  margin-top: 6px;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-muted);
  font-size: 12px;
  padding: 6px 8px;
  transition: color 150ms ease, transform 150ms ease, filter 150ms ease;
}

.video-meta-inline {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-start;
  overflow: hidden;
}

.board-inline-meta-item {
  min-width: 0;
  max-width: 46%;
  flex: 0 1 auto;
}

.board-inline-meta-item .tag-chip,
.board-inline-meta-item .status-chip {
  max-width: 100%;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.board-meta-divider {
  color: var(--brand-muted);
  font-size: 11px;
  line-height: 1;
  flex: 0 0 auto;
}

.video-meta-inline .board-month-trigger,
.video-meta-inline .board-chip-trigger {
  width: auto;
}

.video-meta-inline .board-month-trigger.board-inline-meta-item {
  flex: 0 0 auto;
  max-width: 34%;
}

.video-meta-inline .video-meta-trigger.board-inline-meta-item {
  flex: 0 0 auto;
}

.video-meta-inline .video-meta-trigger {
  margin-top: 0;
  width: auto;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.video-meta-trigger:hover .tag-chip,
.video-meta-trigger:hover .status-chip {
  filter: brightness(0.98);
  transform: translateX(1px);
}

.video-meta-trigger:not(.is-chip):hover {
  filter: brightness(0.98);
  transform: translateX(1px);
}

.video-meta-trigger.is-chip {
  width: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.video-meta-trigger.is-chip .tag-chip {
  font-size: 11px;
  padding: 3px 8px;
}

.video-script-jump {
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--brand-teal);
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  justify-content: flex-start;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-script-jump:hover,
.video-script-jump:focus-visible {
  color: #0f6b64;
  transform: translateX(1px);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid rgba(22, 22, 22, 0.08);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.content-table .status-chip {
  font-weight: 500;
}

.chip-idea { background: #e7e0d2; color: #5e5340; }
.chip-script { background: #d8e5f6; color: #335d96; }
.chip-filmed { background: #f5e1a8; color: #8c6611; }
.chip-editing { background: #f3dcc6; color: #a46022; }
.chip-awaiting_approval { background: #ebddf6; color: #7f49ab; }
.chip-approved { background: #d2ead7; color: #26754b; }
.chip-scheduled { background: #f7d6e7; color: #a33e74; }

.table-wrap {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  min-width: 0;
  margin-left: 32px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap::-webkit-scrollbar {
  height: 0;
  display: none;
}

.table-wrap::-webkit-scrollbar-track {
  display: none;
}

.table-wrap::-webkit-scrollbar-thumb {
  display: none;
}

.grid-add-wrap {
  margin-top: 0;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.22);
}

.grid-add-inline {
  margin-bottom: 8px;
}

#view-grid .table-wrap:hover + .grid-add-wrap .grid-add-inline,
#view-grid .table-wrap:focus-within + .grid-add-wrap .grid-add-inline,
#view-grid .grid-add-wrap:hover .grid-add-inline,
#view-grid .grid-add-wrap:focus-within .grid-add-inline {
  max-height: 44px;
  margin-top: 8px;
  padding: 8px 10px;
  border-color: rgba(10, 91, 85, 0.24);
  opacity: 1;
  transform: translateY(0);
}

.content-table {
  width: max-content;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

.content-table th,
.content-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.06);
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
}

.content-table th {
  position: sticky;
  top: 0;
  background: rgba(255, 248, 218, 0.94);
  z-index: 2;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-muted);
  border-right: 1px solid rgba(22, 22, 22, 0.06);
}

.content-table td {
  border-right: 1px solid rgba(22, 22, 22, 0.06);
  font-weight: 400;
  position: relative;
  overflow: visible;
}

/* Keep link cells visible so invalid-link tooltips can render above the table. */
.content-table td:nth-child(5),
.content-table td:nth-child(6),
.content-table td:nth-child(7) {
  overflow: visible;
}

.property-button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: 700;
  justify-content: flex-start;
}

.property-button:disabled,
.property-button.property-button-locked {
  cursor: default;
  opacity: 1;
  pointer-events: none;
}

.resizable-th {
  position: relative;
}

.col-resizer {
  position: absolute;
  top: 0;
  right: -6px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}

body.is-resizing-cols {
  user-select: none;
  cursor: col-resize;
}

.grid-title-cell {
  position: relative;
  min-width: 0;
  overflow: visible;
  padding-right: 0;
}

.grid-title-actions {
  position: absolute;
  top: -4px;
  right: -2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 160ms ease, transform 180ms ease;
  z-index: 3;
}

.grid-title-cell:hover .grid-title-actions,
.grid-title-cell:focus-within .grid-title-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.grid-title-actions .edit-inline-btn {
  opacity: 1;
  pointer-events: auto;
}

.grid-row-open {
  position: static;
  overflow: visible;
  max-width: none;
  transform: none;
  padding: 0 10px;
  background: #fff;
  border-color: rgba(22, 22, 22, 0.18);
  box-shadow: 0 1px 0 rgba(22, 22, 22, 0.08);
}

.grid-row-delete {
  opacity: 1;
  pointer-events: auto;
}

.grid-input,
.grid-select {
  min-width: 110px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
}

.grid-title-input {
  width: 100%;
}

.grid-text {
  display: inline-block;
  padding: 8px 4px;
  min-height: 18px;
  color: var(--brand-ink);
  font-weight: 400;
  max-width: 100%;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-title-cell .grid-text {
  display: block;
  width: 100%;
  font-weight: 700;
}

.grid-title-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-link {
  display: inline-block;
  color: var(--brand-red);
  font-weight: 400;
  text-decoration: none;
  padding: 8px 4px;
  word-break: break-word;
}

.grid-script-link {
  border: 0;
  background: transparent;
  color: var(--brand-teal);
  padding-left: 0;
  padding-right: 0;
  font-weight: 600;
}

.grid-script-link:hover,
.grid-script-link:focus-visible {
  color: #0f6b64;
}

.grid-link-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  position: relative;
  isolation: auto;
  padding-right: 0;
}

.grid-link-wrap .grid-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.link-invalid-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ff4b4b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(99, 0, 0, 0.18);
  cursor: default;
  position: relative;
}

.grid-link-wrap .link-invalid-indicator {
  flex: 0 0 auto;
}

.grid-link-wrap .link-invalid-indicator::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
  z-index: 12000;
}

.grid-invalid-trigger .link-invalid-indicator::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
  z-index: 12000;
}

.grid-link-wrap .link-invalid-indicator:hover::after,
.grid-link-wrap .link-invalid-indicator:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

.grid-invalid-trigger .link-invalid-indicator:hover::after,
.grid-invalid-trigger .link-invalid-indicator:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

.link-invalid-indicator::after {
  content: 'Invalid link format';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: rgba(22, 22, 22, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 9999;
}

.link-invalid-indicator:hover::after,
.link-invalid-indicator:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.grid-invalid-trigger {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 12;
  cursor: default;
}

.grid-link-cell {
  position: relative;
  overflow: visible;
  z-index: 14;
}

.grid-link-cell:hover,
.grid-link-cell:focus-within {
  z-index: 60;
}

.open-hover-btn {
  position: absolute;
  top: -4px;
  right: -2px;
  overflow: hidden;
  max-width: 0;
  padding: 0;
  border-color: rgba(22, 22, 22, 0.16);
  background: #fffdf2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
  transition: max-width 180ms ease, padding 180ms ease, opacity 160ms ease, transform 180ms ease;
  z-index: 3;
}

.grid-title-cell:hover .open-hover-btn {
  max-width: 58px;
  padding: 0 10px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.grid-menu-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--brand-ink);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 400;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  transition: transform 140ms ease, opacity 140ms ease;
}

.grid-menu-btn > * {
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
}

.grid-menu-btn:hover,
.grid-menu-btn:focus {
  transform: translateX(2px);
  opacity: 0.88;
}

.grid-link-open-btn {
  top: -2px;
  right: 0;
  width: 20px;
  height: 20px;
  padding: 0 !important;
  text-decoration: none;
  color: rgba(22, 22, 22, 0.72);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.grid-link-open-btn:hover,
.grid-link-open-btn:focus-visible {
  color: var(--brand-red);
  background: rgba(255, 255, 255, 1);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(99, 0, 0, 0.12);
}

.grid-link-open-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid-link-cell:hover .grid-link-open-btn,
.grid-link-cell:focus-within .grid-link-open-btn {
  max-width: 30px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.grid-link-cell.is-editing .grid-link-open-btn {
  max-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px) scale(0.98);
}

#view-scripts.is-opening-linked-script .scripts-shell {
  animation: linked-script-open 240ms var(--ease-soft);
}

@keyframes linked-script-open {
  from {
    opacity: 0.68;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-title-comments {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 500;
  transition: opacity 160ms ease, transform 180ms ease, color 140ms ease;
}

:root[data-theme='dark'] .grid-title-comments {
  color: #aaa;
}

.grid-title-comments svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

button.grid-title-comments,
button.video-comments-indicator {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

button.grid-title-comments:hover,
button.grid-title-comments:focus-visible,
button.video-comments-indicator:hover,
button.video-comments-indicator:focus-visible {
  color: var(--brand-red);
  transform: translateY(-1px);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--chip-border, rgba(22, 22, 22, 0.08));
  background: var(--chip-bg, rgba(255, 255, 255, 0.8));
  color: var(--chip-fg, var(--brand-ink));
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.grid-checkbox {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  max-width: 14px;
  max-height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(22, 22, 22, 0.28);
  background: rgba(255, 255, 255, 0.9);
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
}

.grid-checkbox:checked {
  background: rgba(10, 91, 85, 0.28);
  border-color: rgba(10, 91, 85, 0.62);
}

.card-open-btn {
  padding: 6px 10px;
}

.board-scroll-proxy {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 8px;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 90;
  border-radius: 999px;
  background: rgba(255, 253, 240, 0.92);
  border: 1px solid rgba(22, 22, 22, 0.08);
}

.board-scroll-proxy > div {
  height: 1px;
}

.page-scroll-proxy {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 220;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(255, 253, 240, 0.92);
  border: 1px solid rgba(22, 22, 22, 0.08);
  box-shadow: 0 -6px 16px rgba(22, 22, 22, 0.06);
}

.page-scroll-proxy > div {
  height: 1px;
}

:root[data-theme='dark'] .board-scroll-proxy {
  background: rgba(22, 22, 22, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  scrollbar-color: rgba(255, 255, 255, 0.45) rgba(255, 255, 255, 0.08);
}

:root[data-theme='dark'] .page-scroll-proxy {
  background: rgba(22, 22, 22, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.3);
  scrollbar-color: rgba(255, 255, 255, 0.45) rgba(255, 255, 255, 0.08);
}

html,
body {
  /* clip instead of hidden — clip prevents horizontal overflow without
     creating a new block formatting context or promoting body to root
     scroll container. Both must be clip; if either is overflow:hidden
     the browser makes body the scroll root which breaks position:sticky */
  overflow-x: clip;
}

.row-open {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand-ink);
  font-weight: 600;
  text-align: left;
  justify-content: flex-start;
}

.table-link {
  color: var(--brand-red);
  font-weight: 700;
  text-decoration: none;
}

.property-menu {
  position: fixed;
  z-index: 112;
  inset: auto;
  background: transparent;
}

.property-menu:not(.hidden) .property-menu-card {
  animation: tfm-pop-in var(--dur-mid) var(--ease-soft);
}

.property-menu-card {
  width: min(420px, calc(100vw - 20px));
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 18px 34px rgba(22, 22, 22, 0.2);
  display: grid;
  gap: 10px;
}

.property-menu-card::-webkit-scrollbar {
  width: 10px;
}

.property-menu-card::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

.property-menu-card::-webkit-scrollbar-thumb {
  background: rgba(10, 91, 85, 0.48);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.property-menu-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.floating-menu {
  position: fixed;
  z-index: 110;
}

#dateMenu {
  z-index: 220;
}

.floating-menu-card.menu-pop,
.property-menu-card.menu-pop {
  animation: tfm-pop-in var(--dur-mid) var(--ease-soft);
}

.floating-menu-card {
  min-width: 220px;
  max-width: 320px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.2);
}

.comments-popup-card {
  width: min(520px, calc(100vw - 24px));
  max-width: min(520px, calc(100vw - 24px));
  min-height: 120px;
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 18px 38px rgba(22, 22, 22, 0.2);
  border-radius: var(--radius-lg);
  padding: 12px;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 170ms ease, transform 210ms var(--ease-soft);
}

.comments-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

.comments-popup-head p {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-ink);
}

#commentsPopup:not(.hidden) .comments-popup-card.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#commentsPopup:not(.hidden) .comments-popup-card.is-closing {
  opacity: 0;
  transform: translateY(10px) scale(0.978);
}

.comments-popup-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

.comments-popup-empty {
  font-size: 13px;
  color: var(--brand-muted);
}

.comments-popup-item {
  display: grid;
  gap: 6px;
}

.comments-popup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comments-popup-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.18);
  color: var(--brand-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

:root[data-theme='dark'] .comments-popup-avatar {
  background: rgba(65, 163, 154, 0.25);
  color: #aaa;
}

.comments-popup-author {
  font-size: 15px;
  font-weight: 600;
}

.comments-popup-date {
  font-size: 13px;
  color: var(--brand-muted);
}

:root[data-theme='dark'] .comments-popup-date {
  color: #999;
}

.comments-popup-body {
  margin: 0;
  color: var(--brand-ink);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.comments-popup-compose {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.comments-popup-compose input {
  min-height: 36px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--brand-ink);
}

:root[data-theme='dark'] .comments-popup-compose input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f5f5f5;
}

:root[data-theme='dark'] .comments-popup-compose input::placeholder {
  color: #888;
}

.comments-popup-send {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(22, 22, 22, 0.16);
  color: rgba(22, 22, 22, 0.72);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.comments-popup-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comments-popup-send:hover,
.comments-popup-send:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.98);
}

.comments-popup-send:disabled,
.comment-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: rgba(22, 22, 22, 0.42);
  border-color: rgba(22, 22, 22, 0.12);
}

.floating-menu-card,
.property-menu-card {
  --scroll-track: rgba(10, 91, 85, 0.16);
  --scroll-thumb: rgba(10, 91, 85, 0.5);
  --scroll-thumb-hover: rgba(10, 91, 85, 0.68);
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.floating-menu-card {
  --scroll-track: rgba(255, 255, 255, 0.14);
  --scroll-thumb: rgba(10, 91, 85, 0.78);
  --scroll-thumb-hover: rgba(10, 91, 85, 0.96);
}

.detail-drawer {
  --scroll-track: rgba(99, 0, 0, 0.1);
  --scroll-thumb: rgba(99, 0, 0, 0.42);
  --scroll-thumb-hover: rgba(99, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.floating-menu-card .mini-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-muted);
  border-color: rgba(22, 22, 22, 0.14);
  padding: 4px 10px;
  min-height: 28px;
  font-size: 11px;
  font-weight: 600;
}

.access-card,
.workspace-edit-card {
  min-width: min(520px, calc(100vw - 32px));
  max-width: 560px;
  background: var(--brand-panel);
  color: var(--brand-ink);
  border: 1px solid var(--brand-border);
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.access-card {
  min-width: min(420px, calc(100vw - 32px));
  max-width: 460px;
  background: #fff;
  border: 1px solid rgba(22, 22, 22, 0.12);
}

.scripts-color-card {
  min-width: min(300px, calc(100vw - 32px));
  max-width: 340px;
}

.scripts-month-filter-card {
  min-width: min(320px, calc(100vw - 32px));
  max-width: 360px;
  padding: 12px 12px 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 20px 40px rgba(22, 22, 22, 0.2);
}

#scriptsMonthFilterMenu .floating-menu-head {
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

#scriptsMonthFilterMenu .floating-menu-head p {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--brand-ink);
}

#scriptsMonthFilterMenu .mini-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-muted);
  border-color: rgba(22, 22, 22, 0.14);
  padding: 2px 10px;
  min-height: 24px;
  font-size: 11px;
  font-weight: 600;
}

.scripts-month-filter-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: min(52vh, 340px);
  overflow: auto;
  padding-right: 2px;
}

.scripts-month-filter-list .floating-menu-option {
  justify-content: center;
  align-items: center;
  padding: 8px 6px;
  min-height: 44px;
}

.scripts-month-filter-list .floating-menu-option .tag-chip {
  font-size: 12px;
  padding: 6px 10px;
}

.scripts-month-filter-empty {
  margin: 0;
  color: var(--brand-muted);
  font-size: 12px;
  padding: 6px 2px 4px;
}

.scripts-doc-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.scripts-color-list {
  display: grid;
  gap: 6px;
}

.scripts-color-option {
  width: 100%;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.8);
  color: var(--brand-ink);
  padding: 9px 10px;
  justify-content: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.scripts-color-option:hover,
.scripts-color-option:focus-visible {
  background: rgba(10, 91, 85, 0.08);
  border-color: rgba(10, 91, 85, 0.24);
}

.scripts-color-option.is-active {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.3);
}

.scripts-color-option-swatch {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 1px solid rgba(22, 22, 22, 0.24);
  flex-shrink: 0;
}

.access-invite-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.access-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.access-members h3 {
  margin: 0;
  font-size: 16px;
}

.members-list {
  display: grid;
  gap: 8px;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 22, 22, 0.08);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.member-row:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(22, 22, 22, 0.14);
}

.member-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(10, 91, 85, 0.18);
  color: var(--brand-teal);
  border: 1px solid rgba(22, 22, 22, 0.1);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.member-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.member-role {
  min-width: 140px;
}

.member-role-readonly {
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.65);
  color: var(--brand-muted);
  font-size: 13px;
  font-weight: 600;
}

.member-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.member-you {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-red);
  background: rgba(99, 0, 0, 0.1);
  border: 1px solid rgba(99, 0, 0, 0.18);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
}

.floating-menu-list {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
  padding-right: 6px;
  scrollbar-width: auto;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

.floating-menu-list::-webkit-scrollbar {
  width: 10px;
}

.floating-menu-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.floating-menu-list::-webkit-scrollbar-thumb {
  background: rgba(10, 91, 85, 0.85);
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.floating-menu-list::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 91, 85, 1);
}

.floating-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.1);
}

.floating-menu-head p {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--brand-ink);
}

.floating-menu-option {
  width: 100%;
  justify-content: flex-start;
  background: rgba(255, 255, 255, 0.7);
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.floating-menu-option:hover,
.floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.24);
}

.floating-menu-option.is-active::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-red);
  transform: translateY(-50%);
}

.floating-menu-option.danger-option {
  color: #7a0a0a;
  border-color: rgba(122, 10, 10, 0.22);
}

.floating-menu-option.danger-option:hover,
.floating-menu-option.danger-option.is-active {
  background: rgba(122, 10, 10, 0.1);
  border-color: rgba(122, 10, 10, 0.35);
  color: #630000;
}

#cellMenu .floating-menu-card {
  min-width: 268px;
  max-width: 360px;
  padding: 12px 12px 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 20px 40px rgba(22, 22, 22, 0.2);
  --scroll-track: rgba(10, 91, 85, 0.12);
  --scroll-thumb: rgba(10, 91, 85, 0.5);
  --scroll-thumb-hover: rgba(10, 91, 85, 0.72);
}

#cellMenu .floating-menu-head {
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

#cellMenu .floating-menu-head p {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--brand-ink);
}

#cellMenu .mini-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-muted);
  border-color: rgba(22, 22, 22, 0.14);
  padding: 2px 10px;
  min-height: 24px;
  font-size: 11px;
  font-weight: 600;
}

#cellMenu .floating-menu-list {
  gap: 6px;
  max-height: min(56vh, 360px);
  padding-right: 2px;
}

#cellMenu .floating-menu-list::-webkit-scrollbar {
  width: 8px;
}

#cellMenu .floating-menu-list::-webkit-scrollbar-track {
  background: rgba(10, 91, 85, 0.12);
  border-radius: 999px;
}

#cellMenu .floating-menu-list::-webkit-scrollbar-thumb {
  background: rgba(10, 91, 85, 0.6);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

#cellMenu .floating-menu-list::-webkit-scrollbar-thumb:hover {
  background: rgba(10, 91, 85, 0.82);
}

#cellMenu .floating-menu-option {
  color: var(--brand-ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

#cellMenu .floating-menu-option:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(10, 91, 85, 0.2);
  transform: translateX(1px);
}

#cellMenu .floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.08);
  border-color: rgba(10, 91, 85, 0.34);
}

#cellMenu .floating-menu-option.is-active::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--option-dot, var(--brand-teal));
  box-shadow: none;
}

#cellMenu[data-field='content_pillar'] .floating-menu-list {
  gap: 2px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

#cellMenu[data-field='content_pillar'] .floating-menu-option,
#cellMenu[data-field='status'] .floating-menu-option {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 2px;
  min-height: 0;
}

#cellMenu[data-field='content_pillar'] .floating-menu-option:hover,
#cellMenu[data-field='status'] .floating-menu-option:hover {
  background: rgba(10, 91, 85, 0.08);
  border: 0;
  transform: none;
}

#cellMenu[data-field='content_pillar'] .floating-menu-option.is-active,
#cellMenu[data-field='status'] .floating-menu-option.is-active {
  background: rgba(10, 91, 85, 0.08);
  border: 0;
}

#cellMenu[data-field='status'] .floating-menu-list {
  gap: 2px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

#cellMenu[data-field='content_pillar'] .floating-menu-option.is-active::after,
#cellMenu[data-field='status'] .floating-menu-option.is-active::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--option-dot, var(--brand-teal));
  box-shadow: none;
}

#cellMenu[data-field='month_label'] .floating-menu-head p {
  font-size: 22px;
  font-weight: 800;
}

#cellMenu[data-field='month_label'] .floating-menu-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

#cellMenu[data-field='month_label'] .floating-menu-option {
  justify-content: center;
  align-items: center;
  padding: 8px 6px;
  min-height: 44px;
}

#cellMenu[data-field='month_label'] .floating-menu-option .tag-chip {
  font-size: 12px;
  padding: 6px 10px;
}

.property-menu-label,
.property-options {
  display: grid;
  gap: 6px;
}

.property-options-head,
.property-menu-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.property-menu-actions {
  margin-top: 12px;
}

.property-options-list {
  display: grid;
  gap: 6px;
}

.property-option-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.property-option-row .property-option-input {
  min-height: 36px;
  padding: 8px 10px;
}

.property-option-row .property-option-delete {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.date-menu-card {
  min-width: 282px;
  max-width: 282px;
  width: 282px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
  box-shadow: 0 16px 34px rgba(22, 22, 22, 0.18);
}

#dateMenu .floating-menu-card {
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  color: var(--brand-ink);
  border: 1px solid rgba(22, 22, 22, 0.12);
}

#dateMenu .mini-btn {
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-muted);
  border: 1px solid rgba(22, 22, 22, 0.14);
  min-height: 24px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.date-menu-input-row {
  margin-bottom: 8px;
}

.date-menu-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(22, 22, 22, 0.16);
  background: rgba(255, 255, 255, 0.88);
  color: var(--brand-ink);
  font-size: 16px;
  line-height: 1.1;
}

.date-menu-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

#dateMenuLabel {
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-ink);
  margin-right: auto;
}

.date-nav-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.date-mini-btn {
  min-height: 24px;
}

.date-menu-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.date-menu-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.date-menu-head {
  font-size: 12px;
  text-transform: none;
  color: var(--brand-muted);
  font-weight: 500;
  opacity: 1;
  text-align: center;
  padding: 4px 0;
}

.date-menu-day {
  background: transparent;
  color: var(--brand-ink);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 6px 0;
  font-weight: 500;
}

.date-menu-day.is-muted {
  opacity: 0.45;
}

.date-menu-day.is-selected-day,
.date-menu-day:hover {
  background: rgba(10, 91, 85, 0.1);
  border-color: rgba(10, 91, 85, 0.28);
  color: var(--brand-ink);
}

.date-menu-day.is-today {
  box-shadow: inset 0 0 0 1px rgba(99, 0, 0, 0.28);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-label {
  min-width: 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  background: transparent;
  border: 1px solid rgba(22, 22, 22, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-day-head,
.calendar-cell {
  background: rgba(255, 253, 240, 0.95);
  border-right: 1px solid rgba(22, 22, 22, 0.08);
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
}

.calendar-day-head:nth-child(7n),
.calendar-cell:nth-child(7n) {
  border-right: 0;
}

.calendar-grid > :nth-last-child(-n + 7) {
  border-bottom: 0;
}

.calendar-day-head {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(22, 22, 22, 0.78);
}

.calendar-cell {
  min-height: 112px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.calendar-cell.is-drop-target {
  background: rgba(10, 91, 85, 0.05);
  box-shadow: inset 0 0 0 1px rgba(10, 91, 85, 0.22);
}

.calendar-date {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-ink);
  margin-bottom: 10px;
}

.calendar-date.is-muted {
  color: rgba(22, 22, 22, 0.35);
}

.calendar-item {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(22, 22, 22, 0.08);
  padding: 9px 10px;
  margin-bottom: 7px;
  color: var(--brand-ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.88));
  box-shadow: 0 1px 2px rgba(22, 22, 22, 0.04);
  cursor: grab;
}

.calendar-item.is-inline-editor {
  padding: 6px;
  cursor: text;
}

.calendar-inline-title-new {
  width: 100%;
  border: 1px solid rgba(10, 91, 85, 0.5);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--brand-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
}

.calendar-add {
  width: 100%;
  margin-top: auto;
  background: rgba(10, 91, 85, 0.08);
  color: var(--brand-teal);
  border: 1px dashed transparent;
  border-radius: var(--radius-md);
  padding: 0 10px;
  max-height: 0;
  justify-content: flex-start;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition: max-height 220ms ease, padding 220ms ease, margin-top 220ms ease, opacity 180ms ease, transform 220ms ease, border-color 220ms ease;
}

.calendar-cell:hover .calendar-add,
.calendar-cell:focus-within .calendar-add {
  max-height: 40px;
  margin-top: 6px;
  padding: 7px 10px;
  border-color: rgba(10, 91, 85, 0.24);
  opacity: 1;
  transform: translateY(0);
}

.calendar-item-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.calendar-drop-indicator {
  height: 4px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.9);
  margin: 0 2px 8px;
  box-shadow: 0 0 0 1px rgba(10, 91, 85, 0.25), 0 2px 7px rgba(10, 91, 85, 0.2);
  pointer-events: none;
}

.calendar-open-btn {
  width: 100%;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: max(0px, env(safe-area-inset-right));
  bottom: 0;
  width: min(460px, calc(100vw - 8px));
  max-width: calc(100vw - 8px);
  height: auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid rgba(22, 22, 22, 0.1);
  background: #fffdf0;
  border-radius: 0;
  box-shadow: -14px 0 34px rgba(22, 22, 22, 0.14);
  z-index: 130;
  display: block;
  opacity: 0;
  transform: translateX(28px);
  pointer-events: none;
  visibility: hidden;
  transition: transform var(--dur-mid) var(--ease-soft), opacity var(--dur-mid) var(--ease-standard), visibility var(--dur-mid) var(--ease-standard);
}

#cellMenu {
  z-index: 240;
}

html.drawer-open,
body.drawer-open {
  overflow-x: hidden;
  scrollbar-width: none;
}

html.drawer-open::-webkit-scrollbar,
body.drawer-open::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.detail-drawer.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
}

@keyframes tfm-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tfm-pop-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
}

.floating-menu.is-closing .floating-menu-card,
.floating-menu.is-closing .property-menu-card {
  animation: tfm-pop-out 120ms var(--ease-standard) forwards;
  pointer-events: none;
}

.drawer-empty {
  display: grid;
  gap: 10px;
  place-content: center;
  min-height: 100%;
}

.drawer-content {
  display: grid;
  gap: 14px;
}

.drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 1px solid rgba(22, 22, 22, 0.06);
}

.detail-form,
.comments-block {
  display: grid;
  gap: 12px;
}

.drawer-title-input {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: clamp(14px, 2.2vw, 22px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--brand-ink);
  min-width: 0;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
  resize: none;
  min-height: 0;
}

.drawer-title-input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.drawer-meta-compact {
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
  margin-top: -2px;
  flex-wrap: nowrap;
  min-width: 0;
}

.drawer-meta-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 0 1 auto;
  cursor: pointer;
}

.drawer-meta-divider {
  color: rgba(22, 22, 22, 0.5);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 2px;
  flex: 0 0 auto;
}

.drawer-chip-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  position: relative;
  z-index: 2;
}

.drawer-chip-btn .status-chip,
.drawer-chip-btn .tag-chip {
  max-width: clamp(80px, 28vw, 170px);
  transition: transform 150ms ease, filter 150ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-chip-btn:hover .status-chip,
.drawer-chip-btn:focus-visible .status-chip,
.drawer-chip-btn:hover .tag-chip,
.drawer-chip-btn:focus-visible .tag-chip {
  filter: brightness(0.98);
  transform: translateX(1px);
}

.drawer-meta-item > span,
.detail-property-key {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-muted);
}

.detail-key-with-warning {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-key-with-warning .link-invalid-indicator {
  width: 14px;
  height: 14px;
  font-size: 10px;
  box-shadow: 0 0 0 1px rgba(99, 0, 0, 0.12);
}

.drawer-properties {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.detail-property-row {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 34px;
}

.detail-property-key {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.detail-property-value {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-items: center;
  align-content: center;
  justify-items: start;
}

.detail-property-value input {
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--brand-ink);
}

.detail-property-value input::placeholder {
  color: rgba(22, 22, 22, 0.42);
}

.detail-property-value input:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.detail-link-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  min-height: 28px;
}

.detail-link-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 0;
}

.detail-link-actions .detail-link {
  font-size: 15px;
  line-height: 1.25;
}

.drawer-date-trigger {
  width: auto;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--brand-ink);
  padding: 0;
  min-height: 0;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.drawer-date-trigger:hover,
.drawer-date-trigger:focus-visible {
  color: var(--brand-teal);
  transform: translateX(1px);
  background: transparent;
  box-shadow: none;
}

.drawer-chip-btn {
  cursor: pointer;
  pointer-events: auto;
}

.checkbox-input {
  width: 20px;
  height: 20px;
  justify-self: start;
  accent-color: var(--brand-red);
}

.comments-list {
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
  padding-bottom: 8px;
}

.comment {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
}

.is-selected {
  border-color: var(--brand-teal) !important;
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.2);
}

.comments-block {
  margin-top: 24px;
}

.comments-block h3 {
  font-size: 16px;
  letter-spacing: 0;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

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

.comment-meta .tiny {
  font-size: 12px;
}

.comment p {
  margin: 0;
  color: var(--brand-ink);
  font-size: 12px;
  line-height: 1.42;
}

.comment-compose {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.1);
  padding-bottom: 8px;
}

.comment-compose-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(99, 0, 0, 0.14);
  color: var(--brand-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}

#commentBody {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  font-size: 14px;
}

#commentBody:focus {
  outline: none;
  border: 0;
  box-shadow: none;
}

.comment-send-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(22, 22, 22, 0.16);
  color: rgba(22, 22, 22, 0.72);
}

.comment-send-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comment-send-btn:hover,
.comment-send-btn:focus-visible {
  color: var(--brand-red);
  border-color: rgba(99, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.98);
}

.drawer-head .mini-btn {
  min-height: 24px;
  padding: 5px 10px;
  font-size: 11px;
}

.detail-value-text {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  min-height: 0;
}

.comment-input-wrap {
  position: relative;
  min-width: 0;
}

.comment-input-wrap input {
  width: 100%;
}

.comment-reply-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--brand-muted);
}

.comment-reply-cancel {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--brand-red);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 25;
  border: 1px solid rgba(22, 22, 22, 0.12);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 253, 240, 0.98), rgba(252, 246, 223, 0.98));
  box-shadow: 0 -8px 24px rgba(22, 22, 22, 0.14);
  overflow: hidden;
}

.mention-option {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(22, 22, 22, 0.06);
  background: transparent;
  color: var(--brand-ink);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
}

.mention-option:first-child {
  border-top: 0;
}

.mention-option:hover,
.mention-option.is-active {
  background: rgba(10, 91, 85, 0.1);
}

.mention-name {
  font-size: 13px;
  font-weight: 700;
}

.mention-email {
  font-size: 11px;
  color: var(--brand-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mention-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.mention-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(10, 91, 85, 0.16);
  color: var(--brand-teal);
  border: 1px solid rgba(22, 22, 22, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.comment-thread-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 8px;
  position: relative;
}

.comment-rail {
  position: relative;
  min-height: 100%;
}

.comment-rail-dot {
  position: absolute;
  top: 10px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(10, 91, 85, 0.55);
}

:root[data-theme='dark'] .comment-rail-dot {
  background: rgba(76, 175, 80, 0.8);
}

.comment-main {
  min-width: 0;
}

.comment-thread-item.has-children > .comment-rail::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 19px;
  bottom: 5px;
  width: 2px;
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.14);
}

:root[data-theme='dark'] .comment-thread-item.has-children > .comment-rail::after {
  background: rgba(255, 245, 220, 0.25);
}

.comment-thread-item.comment-flash {
  border-radius: var(--radius-sm);
  animation: comment-flash-pulse 940ms var(--ease-soft);
}

@keyframes comment-flash-pulse {
  0% {
    background: rgba(10, 91, 85, 0);
    box-shadow: 0 0 0 0 rgba(10, 91, 85, 0);
  }
  30% {
    background: rgba(10, 91, 85, 0.14);
    box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.18);
  }
  100% {
    background: rgba(10, 91, 85, 0);
    box-shadow: 0 0 0 0 rgba(10, 91, 85, 0);
  }
}

.comment-children {
  display: grid;
  gap: 6px;
  margin-top: 7px;
  margin-left: 0;
  padding-left: 0;
}

.comment-children > .comment-thread-item > .comment-rail::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 11px;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.14);
}

.comment-reply-btn {
  border: 0;
  background: transparent;
  color: var(--brand-teal);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-top: 1px;
}

.comment-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.comment-reply-btn:hover,
.comment-reply-btn:focus-visible {
  color: var(--brand-red);
}

.comment-delete-btn {
  border: 0;
  background: transparent;
  color: var(--brand-teal);
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-standard);
}

.comment-thread-item:hover .comment-delete-btn {
  opacity: 1;
}

.comment-delete-btn:hover,
.comment-delete-btn:focus-visible {
  color: var(--brand-red);
}

.comment-mention {
  color: var(--brand-teal);
  font-weight: 700;
}

.comment-link {
  color: var(--brand-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.comment-link:hover {
  opacity: 0.75;
}
:root[data-theme='dark'] .comment-link {
  color: #5ecec7;
}

:root[data-theme='dark'] body {
  color: #fff5dc;
}

:root[data-theme='dark'] .topbar,
:root[data-theme='dark'] .topbar-app,
:root[data-theme='dark'] .panel,
:root[data-theme='dark'] .login-card,
:root[data-theme='dark'] .floating-menu-card,
:root[data-theme='dark'] .property-menu-card,
:root[data-theme='dark'] .detail-drawer,
:root[data-theme='dark'] .admin-mini-panel,
:root[data-theme='dark'] .workspace-card,
:root[data-theme='dark'] .board-column,
:root[data-theme='dark'] .video-card,
:root[data-theme='dark'] .analytics-kpi,
:root[data-theme='dark'] .analytics-chart-card,
:root[data-theme='dark'] .analytics-table-wrap,
:root[data-theme='dark'] .table-wrap,
:root[data-theme='dark'] .content-table,
:root[data-theme='dark'] .comment-card,
:root[data-theme='dark'] .login-info-card {
  background: linear-gradient(180deg, rgba(36, 36, 36, 0.98), rgba(27, 27, 27, 0.98)) !important;
  border-color: rgba(255, 245, 220, 0.16) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .muted,
:root[data-theme='dark'] .tiny,
:root[data-theme='dark'] .brand-sub,
:root[data-theme='dark'] .crumb,
:root[data-theme='dark'] .workspace-card p,
:root[data-theme='dark'] .dashboard-workspaces-panel > .muted {
  color: rgba(255, 245, 220, 0.84) !important;
}

:root[data-theme='dark'] h1,
:root[data-theme='dark'] h2,
:root[data-theme='dark'] h3,
:root[data-theme='dark'] h4,
:root[data-theme='dark'] th,
:root[data-theme='dark'] td,
:root[data-theme='dark'] .dashboard-panel-title,
:root[data-theme='dark'] .workspace-card h3,
:root[data-theme='dark'] .workspace-name {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .view-tab,
:root[data-theme='dark'] .analytics-tab-btn,
:root[data-theme='dark'] .mini-btn,
:root[data-theme='dark'] .link-btn-secondary,
:root[data-theme='dark'] .property-button,
:root[data-theme='dark'] .grid-filter-btn,
:root[data-theme='dark'] .grid-filter-clear-btn,
:root[data-theme='dark'] .grid-filter-close-btn {
  background: rgba(255, 245, 220, 0.12) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.36) !important;
}

:root[data-theme='dark'] .analytics-tabs {
  background: rgba(255, 245, 220, 0.08) !important;
  border-color: rgba(255, 245, 220, 0.24) !important;
}

:root[data-theme='dark'] .view-tab.is-active,
:root[data-theme='dark'] .analytics-tab-btn.is-active {
  background: #fff5dc !important;
  color: #161616 !important;
  border-color: #fff5dc !important;
}

:root[data-theme='dark'] .brand-kicker,
:root[data-theme='dark'] .hero-eyebrow {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .brand-mark,
:root[data-theme='dark'] .brand-mark-large {
  filter: brightness(0) invert(95%) sepia(17%) saturate(355%) hue-rotate(316deg) brightness(104%) contrast(101%);
}

:root[data-theme='dark'] .wordmark-divider {
  background: rgba(255, 232, 188, 0.7) !important;
}

:root[data-theme='dark'] input,
:root[data-theme='dark'] textarea,
:root[data-theme='dark'] select {
  background: rgba(255, 245, 220, 0.1) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 232, 188, 0.34) !important;
}

:root[data-theme='dark'] input::placeholder,
:root[data-theme='dark'] textarea::placeholder {
  color: rgba(255, 245, 220, 0.68) !important;
}

:root[data-theme='dark'] .status-chip {
  border-color: rgba(255, 255, 255, 0.22);
}

:root[data-theme='dark'] .chip-idea { background: rgba(160, 130, 90, 0.28); color: #d4c8b8; }
:root[data-theme='dark'] .chip-script { background: rgba(70, 130, 180, 0.24); color: #b8d4ff; }
:root[data-theme='dark'] .chip-filmed { background: rgba(180, 150, 80, 0.28); color: #f5e8c0; }
:root[data-theme='dark'] .chip-editing { background: rgba(190, 140, 70, 0.28); color: #ffd9a8; }
:root[data-theme='dark'] .chip-awaiting_approval { background: rgba(160, 130, 180, 0.24); color: #e8c8f8; }
:root[data-theme='dark'] .chip-approved { background: rgba(100, 160, 120, 0.24); color: #b8e8c8; }
:root[data-theme='dark'] .chip-scheduled { background: rgba(180, 100, 140, 0.24); color: #f0c8e0; }

:root[data-theme='dark'] .scripts-status-dot {
  box-shadow: 0 0 0 2px rgba(255, 245, 220, 0.3), 0 0 14px rgba(255, 245, 220, 0.24);
}

:root[data-theme='dark'] .workspace-main,
:root[data-theme='dark'] .workspace-sidebar,
:root[data-theme='dark'] .scripts-paper,
:root[data-theme='dark'] .scripts-comments-rail,
:root[data-theme='dark'] .scripts-toolbar,
:root[data-theme='dark'] .scripts-sidebar,
:root[data-theme='dark'] .calendar-grid,
:root[data-theme='dark'] .calendar-day,
:root[data-theme='dark'] .calendar-item,
:root[data-theme='dark'] .admin-users-list,
:root[data-theme='dark'] .admin-users-list > li,
:root[data-theme='dark'] .admin-user-row,
:root[data-theme='dark'] .admin-sub-row,
:root[data-theme='dark'] .approved-email-card,
:root[data-theme='dark'] .analytics-kpi,
:root[data-theme='dark'] .analytics-chart-card,
:root[data-theme='dark'] .analytics-table-wrap,
:root[data-theme='dark'] .profile-card,
:root[data-theme='dark'] .profile-menu,
:root[data-theme='dark'] .floating-menu-card,
:root[data-theme='dark'] .detail-drawer {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
}

:root[data-theme='dark'] .floating-menu-option {
  background: rgba(255, 245, 220, 0.08) !important;
  border-color: rgba(255, 245, 220, 0.16) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .floating-menu-option:hover,
:root[data-theme='dark'] .floating-menu-option.is-active {
  background: rgba(255, 245, 220, 0.16) !important;
  border-color: rgba(255, 245, 220, 0.32) !important;
}

:root[data-theme='dark'] .admin-user-workspace-names,
:root[data-theme='dark'] .admin-user-workspaces,
:root[data-theme='dark'] .admin-sub-workspace {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .admin-readiness-card,
:root[data-theme='dark'] .admin-readiness-output {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .admin-readiness-card h3,
:root[data-theme='dark'] .admin-readiness-card p {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .admin-changelog-entry {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
}

:root[data-theme='dark'] .admin-changelog-title,
:root[data-theme='dark'] .admin-changelog-version,
:root[data-theme='dark'] .admin-changelog-items li {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .attribution-currency-btns {
  border-color: rgba(255, 255, 255, 0.15);
}

:root[data-theme='dark'] .attribution-curr-btn:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme='dark'] .ac-display {
  color: #fff5dc;
}

:root[data-theme='dark'] .content-table thead th,
:root[data-theme='dark'] .content-table tbody td,
:root[data-theme='dark'] .analytics-table-head,
:root[data-theme='dark'] .analytics-table th,
:root[data-theme='dark'] .analytics-table-wrap thead th,
:root[data-theme='dark'] .analytics-table-wrap tbody td {
  background: rgba(31, 31, 31, 0.96) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.12) !important;
}

:root[data-theme='dark'] .content-table tbody tr:nth-child(even) td,
:root[data-theme='dark'] .analytics-table td,
:root[data-theme='dark'] .analytics-table-wrap tbody tr:nth-child(even) td {
  background: rgba(24, 24, 24, 0.96) !important;
}

:root[data-theme='dark'] .analytics-table-head h4 {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .analytics-actions-head {
  background: rgba(31, 31, 31, 0.96) !important;
}

:root[data-theme='dark'] .analytics-table input {
  color: #fff5dc !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .attribution-panel,
:root[data-theme='dark'] .attribution-summary {
  background: rgba(24, 24, 24, 0.96) !important;
  border-color: rgba(255, 245, 220, 0.2) !important;
}

:root[data-theme='dark'] .attribution-table input,
:root[data-theme='dark'] .attribution-table select {
  color: #fff5dc !important;
  background: rgba(24, 24, 24, 0.98) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .analytics-table input:hover,
:root[data-theme='dark'] .analytics-table input:focus {
  background: rgba(255, 245, 220, 0.1) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .attribution-table input:hover,
:root[data-theme='dark'] .attribution-table input:focus,
:root[data-theme='dark'] .attribution-table select:hover,
:root[data-theme='dark'] .attribution-table select:focus {
  background: rgba(255, 245, 220, 0.1) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .analytics-date-btn,
:root[data-theme='dark'] .analytics-date-btn:hover,
:root[data-theme='dark'] .analytics-date-btn:focus-visible {
  border-color: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .analytics-kpi.is-change.is-negative strong,
:root[data-theme='dark'] .analytics-change.is-negative {
  color: #ff8a8a !important;
}

:root[data-theme='dark'] .analytics-kpi-info {
  background: rgba(255, 245, 220, 0.16) !important;
  border-color: rgba(255, 245, 220, 0.4) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .analytics-kpi:hover .analytics-kpi-info,
:root[data-theme='dark'] .analytics-kpi:focus-within .analytics-kpi-info,
:root[data-theme='dark'] .analytics-kpi-info:focus-visible {
  background: rgba(65, 163, 154, 0.24) !important;
  border-color: rgba(65, 163, 154, 0.56) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .analytics-global-tooltip {
  background: rgba(24, 24, 24, 0.985) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.34) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42) !important;
}

:root[data-theme='dark'] .board-column {
  background: rgba(28, 28, 28, 0.96) !important;
}

:root[data-theme='dark'] .board-column[data-status='idea'] {
  background: rgba(255, 226, 180, 0.14) !important;
  border-color: rgba(255, 226, 180, 0.35) !important;
}

:root[data-theme='dark'] .board-column[data-status='script'] {
  background: rgba(141, 197, 255, 0.14) !important;
  border-color: rgba(141, 197, 255, 0.36) !important;
}

:root[data-theme='dark'] .board-column[data-status='filmed'] {
  background: rgba(255, 225, 110, 0.14) !important;
  border-color: rgba(255, 225, 110, 0.36) !important;
}

:root[data-theme='dark'] .board-column[data-status='editing'] {
  background: rgba(255, 194, 122, 0.15) !important;
  border-color: rgba(255, 194, 122, 0.37) !important;
}

:root[data-theme='dark'] .board-column[data-status='awaiting_approval'] {
  background: rgba(214, 168, 255, 0.14) !important;
  border-color: rgba(214, 168, 255, 0.36) !important;
}

:root[data-theme='dark'] .board-column[data-status='approved'] {
  background: rgba(135, 239, 174, 0.14) !important;
  border-color: rgba(135, 239, 174, 0.36) !important;
}

:root[data-theme='dark'] .board-column[data-status='scheduled'] {
  background: rgba(255, 166, 218, 0.14) !important;
  border-color: rgba(255, 166, 218, 0.36) !important;
}

:root[data-theme='dark'] .video-card {
  background: rgba(38, 38, 38, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.16) !important;
}

:root[data-theme='dark'] .workspace-meta {
  background: transparent !important;
  border-color: rgba(255, 245, 220, 0.12) !important;
}

:root[data-theme='dark'] #workspaceDriveLink,
:root[data-theme='dark'] #newVideoButton {
  background: rgba(201, 90, 90, 0.24) !important;
  color: #fff5dc !important;
  border: 1px solid rgba(255, 245, 220, 0.3) !important;
  font-weight: 700 !important;
}

:root[data-theme='dark'] #workspaceDriveLink {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .instagram-link-logo svg,
:root[data-theme='dark'] #workspaceInstagramLink {
  color: #fff5dc !important;
}

:root[data-theme='dark'] #newVideoButton::before {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-paper [contenteditable],
:root[data-theme='dark'] .scripts-paper,
:root[data-theme='dark'] .scripts-paper * {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-paper hr {
  border-color: rgba(255, 236, 198, 0.22) !important;
}

:root[data-theme='dark'] .analytics-bar.is-reach {
  background: linear-gradient(180deg, rgba(201, 90, 90, 0.95), rgba(168, 60, 60, 0.72)) !important;
}

:root[data-theme='dark'] .analytics-bar.is-reach.is-zero {
  background: rgba(201, 90, 90, 0.6) !important;
}

:root[data-theme='dark'] .mention-menu {
  background: rgba(42, 42, 42, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.32) !important;
}

:root[data-theme='dark'] .admin-user-row {
  background: transparent !important;
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
}

:root[data-theme='dark'] .admin-user-row:hover {
  background: rgba(255, 255, 255, 0.03) !important;
}

:root[data-theme='dark'] .admin-role-legend > div,
:root[data-theme='dark'] .admin-toolbar,
:root[data-theme='dark'] .admin-summary-card,
:root[data-theme='dark'] .admin-nav,
:root[data-theme='dark'] .admin-nav-btn,
:root[data-theme='dark'] .scripts-tab,
:root[data-theme='dark'] .scripts-group,
:root[data-theme='dark'] .mention-option,
:root[data-theme='dark'] .script-comment-card,
:root[data-theme='dark'] .profile-section,
:root[data-theme='dark'] .login-info-add-card {
  background: rgba(42, 42, 42, 0.92) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-group-label,
:root[data-theme='dark'] .scripts-tab-label {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-group-dot,
:root[data-theme='dark'] .scripts-tab-dot {
  background: #2fd2c2 !important;
}

:root[data-theme='dark'] .scripts-tab.is-active {
  background: rgba(255, 245, 220, 0.08) !important;
  border-color: rgba(47, 210, 194, 0.52) !important;
  box-shadow: inset 3px 0 0 #2fd2c2 !important;
}

:root[data-theme='dark'] .scripts-status-dot-wrap::after {
  background: rgba(24, 24, 24, 0.98) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.3) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35) !important;
}

:root[data-theme='dark'] #scriptsAddDoc {
  color: #fff5dc !important;
}

:root[data-theme='dark'] #scriptsAddDoc:hover,
:root[data-theme='dark'] #scriptsAddDoc:focus-visible {
  color: #2fd2c2 !important;
}

:root[data-theme='dark'] .tag-chip {
  background: rgba(255, 245, 220, 0.14) !important;
  border-color: rgba(255, 245, 220, 0.34) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-tab-right .status-chip {
  font-weight: 800 !important;
  opacity: 1 !important;
  filter: none !important;
  text-shadow: none !important;
  mix-blend-mode: normal !important;
}

:root[data-theme='dark'] .scripts-sidebar .status-chip {
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  font-weight: 800 !important;
  border-width: 1px !important;
  text-shadow: none !important;
}

:root[data-theme='dark'] .scripts-sidebar .status-chip .chip-label {
  opacity: 1 !important;
  filter: none !important;
  color: inherit !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-idea {
  background: #f3ddad !important;
  color: #3c2b00 !important;
  border-color: #d2b06a !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-script {
  background: #89c3ff !important;
  color: #082c57 !important;
  border-color: #5fa5f5 !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-filmed {
  background: #f7d449 !important;
  color: #322500 !important;
  border-color: #d8b72d !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-editing {
  background: #ffbf74 !important;
  color: #4a2400 !important;
  border-color: #de9948 !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-awaiting_approval {
  background: #cca0f2 !important;
  color: #1f0a34 !important;
  border-color: #9c66d4 !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-approved {
  background: #85ecaa !important;
  color: #0a3a1b !important;
  border-color: #59c786 !important;
}

:root[data-theme='dark'] .scripts-sidebar .chip-scheduled {
  background: #ffaadf !important;
  color: #56153d !important;
  border-color: #dd77ba !important;
}

:root[data-theme='dark'] .script-highlight-span {
  background: rgba(65, 163, 154, 0.42) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 245, 220, 0.24);
}

:root[data-theme='dark'] .script-highlight-span.is-active {
  background: rgba(65, 163, 154, 0.62) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 245, 220, 0.34), 0 1px 3px rgba(0, 0, 0, 0.26);
}

:root[data-theme='dark'] .scripts-tab-right .chip-filmed {
  background: #f7d449 !important;
  color: #322500 !important;
  border-color: #d8b72d !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-idea {
  background: #f3ddad !important;
  color: #3c2b00 !important;
  border-color: #d2b06a !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-script {
  background: #89c3ff !important;
  color: #082c57 !important;
  border-color: #5fa5f5 !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-editing {
  background: #ffbf74 !important;
  color: #4a2400 !important;
  border-color: #de9948 !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-awaiting_approval {
  background: #d6a8ff !important;
  color: #351053 !important;
  border-color: #b277eb !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-approved {
  background: #85ecaa !important;
  color: #0a3a1b !important;
  border-color: #59c786 !important;
}

:root[data-theme='dark'] .scripts-tab-right .chip-scheduled {
  background: #ffaadf !important;
  color: #56153d !important;
  border-color: #dd77ba !important;
}

:root[data-theme='dark'] .scripts-tab:hover .status-chip,
:root[data-theme='dark'] .scripts-tab:focus-within .status-chip,
:root[data-theme='dark'] .scripts-tab.is-active .status-chip {
  opacity: 1 !important;
  filter: brightness(1.03) saturate(1.05) !important;
}

:root[data-theme='dark'] .scripts-sort-btn,
:root[data-theme='dark'] #scriptsAddDoc,
:root[data-theme='dark'] #scriptsBackToScripts {
  background: rgba(255, 245, 220, 0.14) !important;
  border-color: rgba(255, 245, 220, 0.36) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-sort-btn:hover,
:root[data-theme='dark'] .scripts-sort-btn:focus-visible,
:root[data-theme='dark'] #scriptsBackToScripts:hover,
:root[data-theme='dark'] #scriptsBackToScripts:focus-visible {
  background: rgba(65, 163, 154, 0.24) !important;
  border-color: rgba(65, 163, 154, 0.58) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .scripts-tab-delete {
  background: rgba(255, 245, 220, 0.16) !important;
  border-color: rgba(255, 245, 220, 0.34) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .grid-checkbox,
:root[data-theme='dark'] .checkbox-input {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  display: inline-block;
  vertical-align: middle;
  background: rgba(255, 245, 220, 0.12) !important;
  border: 1px solid rgba(255, 245, 220, 0.34) !important;
  border-radius: 4px;
}

:root[data-theme='dark'] .grid-checkbox {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
}

:root[data-theme='dark'] .checkbox-input {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
}

:root[data-theme='dark'] .grid-checkbox:checked,
:root[data-theme='dark'] .checkbox-input:checked {
  background: rgba(65, 163, 154, 0.34) !important;
  border-color: rgba(65, 163, 154, 0.68) !important;
  box-shadow: inset 0 0 0 2px rgba(22, 22, 22, 0.52);
}

:root[data-theme='dark'] .board-inline-pillar-placeholder {
  color: #fff5dc !important;
  background: rgba(255, 245, 220, 0.14) !important;
  border-color: rgba(255, 245, 220, 0.34) !important;
}

:root[data-theme='dark'] .calendar-grid {
  background: rgba(23, 23, 23, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.2) !important;
}

:root[data-theme='dark'] .calendar-day-head,
:root[data-theme='dark'] .calendar-cell {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.12) !important;
}

:root[data-theme='dark'] .calendar-day-head,
:root[data-theme='dark'] .calendar-date,
:root[data-theme='dark'] .calendar-label {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .calendar-date.is-muted {
  color: rgba(255, 245, 220, 0.46) !important;
}

:root[data-theme='dark'] .calendar-item {
  background: rgba(45, 45, 45, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .detail-drawer .drawer-title-input,
:root[data-theme='dark'] .detail-drawer .detail-value-text,
:root[data-theme='dark'] .detail-drawer .detail-link,
:root[data-theme='dark'] .detail-drawer .drawer-date-trigger,
:root[data-theme='dark'] .detail-drawer #commentBody {
  background: transparent !important;
  box-shadow: none !important;
}

:root[data-theme='dark'] .detail-drawer .drawer-title-input,
:root[data-theme='dark'] .detail-drawer .detail-value-text,
:root[data-theme='dark'] .detail-drawer .detail-link,
:root[data-theme='dark'] .detail-drawer .drawer-date-trigger,
:root[data-theme='dark'] .detail-drawer #commentBody,
:root[data-theme='dark'] .detail-drawer .detail-property-key,
:root[data-theme='dark'] .detail-drawer .comment,
:root[data-theme='dark'] .detail-drawer .comments-block h3 {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .detail-drawer .comment-send-btn {
  background: rgba(255, 245, 220, 0.14) !important;
  border-color: rgba(255, 245, 220, 0.24) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .script-selection-comment-btn {
  background: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.38) !important;
}

:root[data-theme='dark'] .script-selection-comment-btn:hover,
:root[data-theme='dark'] .script-selection-comment-btn:focus-visible {
  background: rgba(65, 163, 154, 0.24) !important;
  border-color: rgba(65, 163, 154, 0.58) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .profile-card,
:root[data-theme='dark'] .profile-settings-card,
:root[data-theme='dark'] .profile-avatar-preview-card {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}

:root[data-theme='dark'] .profile-name,
:root[data-theme='dark'] .profile-email,
:root[data-theme='dark'] .profile-settings-card label,
:root[data-theme='dark'] .profile-settings-card .floating-menu-head p,
:root[data-theme='dark'] .profile-alerts-group .meta-label,
:root[data-theme='dark'] .profile-settings-card .checkline {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .profile-alerts-group,
:root[data-theme='dark'] .profile-settings-card .checkline,
:root[data-theme='dark'] .profile-file-upload-wrap {
  background: rgba(255, 245, 220, 0.08) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
}

:root[data-theme='dark'] .profile-file-upload-wrap .file-pick-btn {
  color: #fffad9 !important;
  border-color: rgba(255, 250, 217, 0.3) !important;
  background: rgba(255, 250, 217, 0.08) !important;
}

:root[data-theme='dark'] .file-upload-name {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .file-upload-wrap {
  border-color: rgba(255, 250, 217, 0.18) !important;
  background: rgba(255, 250, 217, 0.06) !important;
}

:root[data-theme='dark'] .profile-settings-card .checkline input[type="checkbox"] {
  background: rgba(255, 245, 220, 0.1) !important;
  border-color: rgba(255, 245, 220, 0.36) !important;
}

:root[data-theme='dark'] .workspace-card .workspace-kicker,
:root[data-theme='dark'] .workspace-card .workspace-open-hint,
:root[data-theme='dark'] .scripts-comments-head span,
:root[data-theme='dark'] .script-comment-date,
:root[data-theme='dark'] .mention-email {
  color: rgba(255, 245, 220, 0.76) !important;
}

:root[data-theme='dark'] .column-label,
:root[data-theme='dark'] .column-divider,
:root[data-theme='dark'] .column-count {
  color: #fff5dc !important;
}

:root[data-theme='dark'] .board-column-plus {
  color: #fff5dc !important;
}

@media (max-width: 1280px) {
  .workspace-shell,
  .workspace-shell.has-selection {
    grid-template-columns: 204px minmax(0, 1fr);
  }

  .workspace-heading {
    font-size: clamp(40px, 5.4vw, 62px);
  }

  .workspace-shell,
  .page-shell {
    padding: 14px;
    gap: 14px;
  }

  .topbar {
    padding: 14px 18px;
    gap: 14px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-actions .link-btn,
  .topbar-actions .mini-btn {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

@media (max-width: 1160px) {
  .workspace-shell,
  .workspace-shell.has-selection {
    grid-template-columns: 192px minmax(0, 1fr);
  }

  .topbar {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 10px;
  }

  .brand-lockup-wide {
    min-width: 0;
    flex: 1 1 360px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .topbar-actions #backupNowButton,
  .topbar-actions #restoreBackupButton {
    display: none;
  }

  .mobile-top-menu-toggle {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .view-tabs-row {
    gap: 10px;
  }

  .view-tabs {
    gap: 8px;
  }

  .view-tab {
    padding: 9px 14px;
    font-size: 14px;
  }

  #newVideoButton {
    white-space: nowrap;
  }
}

@media (max-width: 1024px) {
  .workspace-shell,
  .workspace-shell.has-selection {
    grid-template-columns: 184px minmax(0, 1fr);
  }

  .topbar {
    padding: 12px 14px;
    gap: 12px;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions #adminHubButton {
    margin-left: auto;
  }

  .detail-drawer {
    width: min(460px, calc(100vw - 8px));
    max-width: calc(100vw - 8px);
  }

  .scripts-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .scripts-editor-area {
    grid-template-columns: 1fr;
  }

  .scripts-comments-rail {
    position: static;
    max-height: 320px;
  }

  .scripts-paper {
    padding: 32px 30px;
    min-height: 900px;
  }

  .scripts-doc-title-input {
    font-size: 32px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-compact-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-summary-grid {
    gap: 6px;
  }

  .admin-nav {
    gap: 6px;
  }

  .admin-role-legend {
    gap: 4px;
  }

  .admin-readiness-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .workspace-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .workspace-heading {
    font-size: clamp(34px, 6.6vw, 52px);
  }

  .workspace-meta-row {
    width: 100%;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .workspace-meta {
    max-width: 100%;
    flex: 1 1 0%;
    width: 0;
    padding: 14px;
  }

  .view-tabs-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .new-video-tabs-slot {
    margin-left: 0;
  }
}

@media (max-width: 780px) {
  .workspace-shell,
  .workspace-shell.has-selection {
    grid-template-columns: 1fr;
  }

  .workspace-sidebar {
    display: none;
  }

  .workspace-shell.sidebar-collapsed .workspace-sidebar {
    display: none;
  }

  .sidebar-show-btn {
    display: inline-flex !important;
  }

  .workspace-main,
  .detail-drawer,
  .panel {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .topbar-actions .link-btn,
  .topbar-actions .mini-btn {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
  }

  .view-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    /* Allow tabs to shrink to fill available space before wrapping */
    min-width: 0;
    flex: 1 1 auto;
  }

  .view-tabs::-webkit-scrollbar {
    display: none;
  }

  .view-tab {
    flex: 0 0 auto;
  }

  .view-tabs-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* New video + sort/filter slot: full second row, right-aligned */
  .new-video-tabs-slot {
    flex: 1 1 100%;
    margin-left: 0;
    justify-content: flex-end;
    gap: 8px;
  }

  .view-tabs-row #newVideoButton {
    margin-left: 0;
  }

  .calendar-top-nav {
    margin-left: 0;
  }

  #gridSortButton,
  #boardMonthFilterButton {
    margin-left: 0;
  }

  /* Hide custom scrollbar on mobile — users swipe to scroll the board */
  .page-scroll-proxy {
    display: none !important;
  }

  .analytics-charts {
    grid-template-columns: 1fr;
  }

  .admin-user-head {
    grid-template-columns: 1fr;
  }

  .admin-user-controls {
    grid-template-columns: 1fr 1fr;
  }

  .admin-sub-row {
    grid-template-columns: 1fr;
  }

  .admin-sub-add-row {
    grid-template-columns: 1fr;
  }

  .approved-email-add {
    grid-template-columns: 1fr;
  }

  .admin-summary-grid {
    gap: 4px;
  }

  .dashboard-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-panel-head .link-btn {
    width: 100%;
  }

  .admin-users-list,
  .approved-email-list {
    max-height: none;
  }

  .approved-email-head {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .approved-email-actions {
    width: auto;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .approved-email-editor-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 10px 12px;
    align-items: center;
  }

  .brand-lockup-wide {
    min-width: 0;
    gap: 10px;
  }

  .brand-lockup-wide > div {
    min-width: 0;
  }

  .crumb {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .wordmark-row {
    gap: 6px;
  }

  .brand-kicker {
    font-size: 10px;
    letter-spacing: 0.11em;
  }

  .brand-sub {
    font-size: 11px;
  }

  .topbar-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 8px;
  }

  .topbar-actions #backupNowButton,
  .topbar-actions #adminHubButton,
  .topbar-actions #crmHubButton,
  .topbar-actions #editorUsageTicker,
  .topbar-actions #accessButton,
  .topbar-actions #profileButton {
    display: none;
  }

  .mobile-top-menu-toggle {
    display: inline-flex;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .workspace-shell,
  .page-shell {
    padding: 10px;
    gap: 10px;
  }

  .workspace-main,
  .detail-drawer,
  .login-card,
  .panel {
    padding: 12px;
  }

  .workspace-heading {
    font-size: clamp(30px, 9.8vw, 42px);
    max-width: none;
    line-height: 0.92;
  }

  .workspace-copy {
    margin-top: 10px;
    font-size: 18px;
    line-height: 1.25;
  }

  .workspace-meta {
    flex: 1 1 0%;
    width: 0;
    max-width: none;
    padding: 12px;
  }

  .workspace-meta a {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
  }

  .section-head {
    grid-template-columns: 1fr;
    display: grid;
    align-items: flex-start;
  }

  .board {
    grid-auto-columns: minmax(228px, 88vw);
    gap: 10px;
  }

  .board-column {
    padding: 8px 8px 6px;
  }

  .view-tabs-row {
    margin-bottom: 8px;
    gap: 8px;
    justify-content: space-between;
  }

  .view-tabs-row .view-tabs,
  .view-tabs-row #newVideoTabsSlot,
  .view-tabs-row #gridSortButton,
  .view-tabs-row #boardMonthFilterButton,
  .view-tabs-row #calendarTopNav {
    display: none !important;
  }

  .mobile-tools-toggle {
    display: inline-flex;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
    margin-left: auto;
  }

  .drawer-meta-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .detail-property-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .drawer-title-input {
    font-size: clamp(14px, 7vw, 28px);
  }

  .calendar-grid {
    min-width: 760px;
  }

  .detail-drawer {
    width: calc(100vw - 6px);
    max-width: calc(100vw - 6px);
  }

  .page-scroll-proxy {
    left: 0;
    right: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .scripts-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .scripts-sidebar {
    max-height: 220px;
  }

  .scripts-editor-area {
    grid-template-columns: 1fr;
  }

  .scripts-toolbar {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .scripts-paper {
    min-height: 680px;
    padding: 22px 16px;
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .scripts-paper [contenteditable],
  .scripts-paper p,
  .scripts-paper h1,
  .scripts-paper h2,
  .scripts-paper h3 {
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
  }

  .scripts-comments-rail {
    max-height: 260px;
  }

  .scripts-doc-title-input {
    font-size: 28px;
  }

  .attribution-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

@media (max-width: 640px) {
  .topbar {
    padding: 9px 10px;
    flex-wrap: nowrap; /* override 1160px wrap — everything stays on ONE row */
    align-items: center;
    row-gap: 0;
  }

  /* Brand lockup shrinks to fit, never forces a second row */
  .brand-lockup-wide {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    align-items: center;
  }

  /* Brand name truncates rather than overflowing */
  .brand-kicker {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
  }

  /* Actions stay at their natural width and don't wrap */
  .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
    margin-left: 0;
  }

  .brand-kicker {
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .brand-sub {
    font-size: 10px;
  }

  .crumb {
    font-size: 11px;
  }

  .workspace-shell,
  .page-shell {
    padding: 8px;
    gap: 8px;
  }

  .workspace-main,
  .panel,
  .detail-drawer {
    padding: 10px;
  }

  .workspace-heading {
    font-size: clamp(28px, 9.4vw, 38px);
  }

  .workspace-meta {
    padding: 10px;
  }

  .meta-link-row {
    width: 100%;
  }

  #workspaceDriveLink,
  #workspaceInstagramLink {
    white-space: normal;
    line-height: 1.25;
  }

  /* Calendar: let it scroll horizontally on small phones instead of clipping */
  #view-calendar {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  /* Board: extra padding at bottom so last card isn't hidden behind browser UI */
  .board {
    padding-bottom: 56px;
  }

  /* Hide the wordmark divider and sub-text on small screens to save topbar space */
  .wordmark-divider,
  .brand-sub {
    display: none;
  }

  /* Grid view: remove left margin, allow full-width horizontal scroll */
  .table-wrap {
    margin-left: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* Grid filter bar: allow wrapping on small screens */
  .grid-filter-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .brand-lockup {
    gap: 8px;
  }

  .brand-mark,
  .brand-mark-large {
    width: 40px;
    height: 40px;
  }

  .wordmark-divider {
    width: 30px;
  }

  .login-card h1 {
    font-size: clamp(30px, 10vw, 40px);
  }

  .board {
    /* ~85vw per column so ~15% of the next column peeks, signalling swipeability */
    grid-auto-columns: min(320px, calc(100vw - 74px));
    gap: 10px;
    padding-right: 10px;
    margin-top: -8px;
  }

  .column-label,
  .column-divider,
  .column-count {
    font-size: 12px;
  }

  /* Improve card touch targets on mobile */
  .video-card-open,
  .video-card-delete,
  .board-add,
  .board-column-plus {
    min-height: 36px;
    padding: 8px 10px;
  }

  .attribution-submit-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== MOBILE PHONE OVERRIDES (≤640px) ===== */

@media (max-width: 640px) {
  /* Header: hide the topbar crumb — replaced by mobile-back-crumb in content area */
  .crumb {
    display: none;
  }

  /* Show the mobile back crumb inside workspace-main */
  .mobile-back-crumb {
    display: block;
    font-size: 12px;
    color: var(--brand-muted);
    text-decoration: none;
    margin-bottom: 10px;
  }

  /* Header: show Workspaces in topbar for admin, hide original sidebar-show-btn */
  .topbar-workspaces-btn {
    display: inline-flex;
  }

  .sidebar-show-btn {
    display: none !important;
  }

  /* Header: tighten the brand lockup so everything sits on one line */
  .brand-lockup-wide {
    gap: 8px;
    align-items: center;
  }

  .wordmark-row {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* Toolbar row: remove Activity — it's redundant on mobile */
  .activity-drawer-toggle {
    display: none !important;
  }

  /* Drawer: slide up from bottom on mobile — override desktop translateX entirely */
  .detail-drawer {
    transform: translateY(100%);
    opacity: 0;
    will-change: transform;
    /* Explicitly re-declare transition so translateY (not translateX) is animated */
    transition: transform 300ms cubic-bezier(0.34, 1.1, 0.64, 1),
                opacity 240ms ease,
                visibility 300ms ease;
  }

  .detail-drawer.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  /* Analytics: one KPI per row on phone */
  .analytics-summary {
    flex-wrap: wrap;
    gap: 6px;
  }

  .analytics-summary .analytics-kpi {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  /* Toolbar: show sort/filter/new-video icons on mobile */
  .view-tabs-row #newVideoTabsSlot {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
  }

  .view-tabs-row #gridSortButton,
  .view-tabs-row #boardMonthFilterButton {
    display: inline-flex !important;
    margin-left: 0;
    width: 36px;
    height: 36px;
  }

  /* New video: compact icon-only circle button — flex-centred icon */
  #newVideoButton {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #newVideoButton .new-video-text {
    display: none;
  }

  #newVideoButton .new-video-icon {
    display: block;
    flex-shrink: 0;
  }

  /* Brand kicker: keep readable minimum on phone */
  .brand-kicker {
    font-size: 11px;
  }

  /* Drawer close button: 44px touch target */
  #drawerClose {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile top menu toggle: 44px touch target */
  .mobile-top-menu-toggle {
    min-height: 44px;
    padding: 0 12px;
    font-size: 13px;
  }

  /* Sort & filter icon buttons: ensure icon is centred */
  .view-tabs-row #gridSortButton svg,
  .view-tabs-row #boardMonthFilterButton svg {
    flex-shrink: 0;
    display: block;
  }

  /* Scripts toolbar: smaller buttons so two rows fit compactly */
  .scripts-toolbar {
    gap: 4px;
    padding: 6px;
  }

  .scripts-format-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 0 6px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .scripts-size-select,
  .scripts-color-button,
  .scripts-month-filter-button,
  .scripts-howto-button {
    font-size: 12px;
    padding: 6px 8px;
    min-height: 36px;
  }

  .scripts-search-input {
    width: 100%;
    font-size: 12px;
  }

  /* Document tabs sidebar: collapsible on mobile */
  .scripts-sidebar {
    overflow: hidden;
  }

  .scripts-sidebar-head {
    cursor: pointer;
    user-select: none;
  }

  .scripts-sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(22, 22, 22, 0.12);
    border-radius: 50%;
    background: transparent;
    color: var(--brand-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    order: -1; /* always leftmost in the flex row */
  }

  /* Collapsed: chevron rotates to point right (indicating "expand") */
  .scripts-sidebar.is-collapsed .scripts-sidebar-toggle {
    transform: rotate(-90deg);
  }

  .scripts-sidebar .scripts-tabs {
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 800px;
    opacity: 1;
    overflow: hidden;
  }

  .scripts-sidebar.is-collapsed .scripts-tabs {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }

  /* Drawer bottom sheet: reset asymmetric desktop border/shadow */
  .detail-drawer {
    border-left: none;
    box-shadow: 0 -6px 24px rgba(22, 22, 22, 0.12);
    border-bottom: none;
  }

  /* Dashboard workspace grid: tighter gap on phones */
  .workspace-grid {
    gap: 8px;
  }

  /* Dashboard profile dropdown: constrain height on small phones */
  .profile-card {
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Sticky drawer title + close button — always visible while scrolling */
  .detail-drawer .drawer-head {
    position: sticky;
    top: 0;
    z-index: 10;
    background: inherit;
    padding-top: 8px;
    margin-top: -8px;
  }

  /* Sticky Comments section header */
  .detail-drawer .comments-block h3 {
    position: sticky;
    top: 56px; /* clears the sticky drawer-head */
    z-index: 9;
    background: inherit;
    padding: 6px 0 4px;
    margin: 0;
  }
}

/* ===== ANIMATIONS & TRANSITIONS ===== */

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confetti {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) }
  100% { opacity: 0; transform: translateY(-40px) rotate(180deg) }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* ===== DRAG & DROP FEEDBACK ===== */

.video-card.is-dragging {
  opacity: 0.6;
  box-shadow: 0 12px 32px rgba(99, 0, 0, 0.25);
  transform: scale(1.02);
  transition: all var(--dur-fast) var(--ease-standard);
}

.board-column.is-drag-over {
  background: rgba(99, 0, 0, 0.05);
  border-radius: var(--radius-md);
  transition: background var(--dur-mid) var(--ease-standard);
}

.dropzone.is-drag-active {
  min-height: 48px;
  background: rgba(10, 91, 85, 0.1);
  border: 1px dashed var(--brand-teal);
  border-radius: var(--radius-sm);
  transition: all var(--dur-mid) var(--ease-standard);
}

/* ===== CARD HOVER & INTERACTIONS ===== */

.video-card {
  transition: all var(--dur-mid) var(--ease-standard);
  position: relative;
}

.video-card:hover:not(.is-dragging) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 0, 0, 0.15);
}

/* ===== STATE TRANSITIONS ===== */

.status-badge {
  transition: all var(--dur-mid) var(--ease-standard);
}

.status-badge.is-transitioning {
  animation: slideUp var(--dur-mid) var(--ease-standard);
}

.column-count {
  transition: color var(--dur-mid) var(--ease-standard);
}

/* ===== EMPTY STATES ===== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--brand-muted);
  min-height: 280px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 250, 217, 0.4), rgba(10, 91, 85, 0.05));
  border: 1px solid var(--brand-border);
  animation: fadeIn var(--dur-slow) var(--ease-soft);
}

:root[data-theme='dark'] .empty-state {
  background: linear-gradient(135deg, rgba(36, 36, 36, 0.4), rgba(65, 163, 154, 0.05));
  border-color: var(--brand-border);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  transition: opacity var(--dur-mid) var(--ease-standard);
}

.empty-state-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--brand-ink);
}

.empty-state-description {
  font-size: 14px;
  color: var(--brand-muted);
  max-width: 320px;
  margin-bottom: 24px;
}

.empty-state-action {
  padding: 8px 16px;
  font-size: 14px;
  background: var(--brand-red);
  color: var(--brand-cream);
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all var(--dur-mid) var(--ease-standard);
}

.empty-state-action:hover {
  background: rgba(99, 0, 0, 0.8);
  transform: translateY(-1px);
}

/* ===== BOARD EMPTY COLUMNS ===== */

.board-column.is-empty .empty-column-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--brand-muted);
  font-size: 13px;
  font-style: italic;
  opacity: 0.6;
  transition: opacity var(--dur-mid) var(--ease-standard);
}

.board-column.is-empty:hover .empty-column-state {
  opacity: 0.8;
}

/* ===== LOADING SKELETONS ===== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0.3) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-sm);
}

:root[data-theme='dark'] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.skeleton-title {
  height: 20px;
  margin-bottom: 12px;
  width: 60%;
  border-radius: var(--radius-sm);
}

.analytics-skeleton {
  display: grid;
  gap: 24px;
}

.skeleton-bar {
  height: 32px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.skeleton-board {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  overflow: hidden;
}

.skeleton-board-column {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-board-header {
  height: 28px;
  width: 70%;
  border-radius: var(--radius-sm);
}

.skeleton-board-card {
  height: 80px;
  border-radius: var(--radius-sm);
}

.skeleton-grid-row {
  height: 40px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
}

/* ===== COMMAND PALETTE ===== */

.command-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 10000;
  animation: fadeIn var(--dur-mid) var(--ease-standard);
}

.command-palette-dialog {
  width: 90%;
  max-width: 600px;
  background: var(--brand-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: slideUp var(--dur-mid) var(--ease-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-ink);
}

:root[data-theme='dark'] .command-palette-dialog {
  background: #1a1a1a;
  border-color: #333333;
}

.command-palette-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--brand-border);
  background: var(--brand-panel);
  font-size: 16px;
  color: var(--brand-ink);
  font-family: inherit;
}

:root[data-theme='dark'] .command-palette-input {
  background: #1a1a1a;
  color: #f5f5f5;
  border-bottom-color: #333333;
}

.command-palette-input::placeholder {
  color: var(--brand-muted);
}

:root[data-theme='dark'] .command-palette-input::placeholder {
  color: #888888;
}

.command-palette-list {
  max-height: 400px;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
}

.command-palette-item {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--brand-ink);
  transition: background var(--dur-fast) var(--ease-standard);
  font-size: 14px;
}

.command-palette-item:hover,
.command-palette-item.is-selected {
  background: rgba(99, 0, 0, 0.1);
}

:root[data-theme='dark'] .command-palette-item {
  color: #f5f5f5;
}

:root[data-theme='dark'] .command-palette-item:hover,
:root[data-theme='dark'] .command-palette-item.is-selected {
  background: rgba(201, 90, 90, 0.15);
}

.command-palette-item-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.6;
}

.command-palette-item-label {
  flex: 1;
}

.command-palette-item-shortcut {
  font-size: 12px;
  color: var(--brand-muted);
  margin-left: auto;
  font-family: monospace;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

:root[data-theme='dark'] .command-palette-item-shortcut {
  background: rgba(255, 255, 255, 0.05);
}

/* ===== CONNECTION INDICATOR ===== */

.connection-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4CAF50;
  border: 2px solid var(--brand-cream);
  transition: all var(--dur-mid) var(--ease-standard);
  cursor: pointer;
}

.connection-indicator.is-pending {
  background: #FFA726;
  animation: pulse 1s ease-in-out infinite;
}

.connection-indicator.is-error {
  background: #EF5350;
  animation: shake 0.4s ease-in-out;
}

.connection-indicator::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  right: 50%;
  transform: translateX(50%);
  margin-bottom: 8px;
  background: var(--brand-ink);
  color: var(--brand-cream);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-mid) var(--ease-standard);
  z-index: 1000;
}

.connection-indicator:hover::after {
  opacity: 1;
}

.connection-tooltip {
  display: none;
}

/* ===== UNSAVED INDICATOR ===== */

.unsaved-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-red);
  animation: pulse 2s ease-in-out infinite;
}

.unsaved-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-red);
  margin-left: 4px;
  animation: pulse 2s ease-in-out infinite;
}

/* ===== AUTO-SAVE INDICATOR ===== */

.auto-save-status {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  background: var(--brand-panel);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--brand-muted);
  animation: slideUp var(--dur-mid) var(--ease-soft);
  z-index: 1000;
  max-width: 200px;
}

.auto-save-status.is-saving {
  color: var(--brand-teal);
}

.auto-save-status.is-saved {
  color: #4CAF50;
}

.auto-save-status.is-error {
  color: var(--brand-red);
}

.auto-save-spinner {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  animation: pulse 1s ease-in-out infinite;
}

/* ===== SUCCESS CELEBRATION ===== */

.celebration-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 24px;
  animation: confetti 1s ease-out forwards;
}

/* ===== DETAIL DRAWER ENHANCEMENTS ===== */

.drawer-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--brand-border);
  transition: all var(--dur-mid) var(--ease-standard);
}

.drawer-section:last-child {
  border-bottom: none;
}

.drawer-section-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--brand-muted);
  margin-bottom: 12px;
  padding: 0 20px;
}

.drawer-unsaved-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--brand-red);
  border-radius: 50%;
  margin-left: 6px;
  animation: pulse 2s ease-in-out infinite;
}

.external-link-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  opacity: 0.5;
  transition: opacity var(--dur-mid) var(--ease-standard);
}

.text-input-field:has(+ .external-link-icon):hover + .external-link-icon {
  opacity: 0.8;
}

/* ===== SIDEBAR ENHANCEMENTS ===== */

.sidebar-search-input {
  width: calc(100% - 32px);
  margin: 12px 16px;
  padding: 8px 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--brand-ink);
  font-size: 13px;
  transition: all var(--dur-mid) var(--ease-standard);
}

.sidebar-search-input:focus {
  outline: none;
  border-color: var(--brand-teal);
  background: var(--input-bg-strong);
}

.sidebar-scroll-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, var(--brand-panel));
  pointer-events: none;
  opacity: 0.6;
  transition: opacity var(--dur-mid) var(--ease-standard);
}

/* ===== MOBILE ENHANCEMENTS ===== */

.pull-to-refresh {
  display: none;
  align-items: center;
  justify-content: center;
  height: 60px;
  color: var(--brand-muted);
  font-size: 12px;
  transition: transform var(--dur-mid) var(--ease-standard);
}

.pull-to-refresh.is-visible {
  display: flex;
}

.pull-to-refresh-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--brand-border);
  border-top-color: var(--brand-teal);
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
}

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

/* Mobile bottom sheet drawer */
@media (max-width: 640px) {
  .detail-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overscroll-behavior: contain;
    touch-action: pan-y;
    /* Add bottom padding for iPhone home indicator */
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Lock page scroll behind the bottom sheet — includes iOS position:fixed trick */
  html.drawer-open,
  body.drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  /* iOS Safari scroll-lock: position:fixed keeps page still behind sheet */
  body.drawer-open {
    position: fixed;
    width: 100%;
  }

  /* Grid filter bar: taller max-height to accommodate wrapped rows on phone */
  .grid-filter-bar.is-open {
    max-height: 220px;
  }

  /* Drawer handle pill: centred, shown only on mobile */
  .drawer-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: var(--brand-border);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
  }
}

/* ===== DARK MODE VARIANTS ===== */

:root[data-theme='dark'][data-theme-variant='midnight'] {
  --brand-cream: #0a0a0a;
  --brand-ink: #f5f5f5;
  --brand-panel: #0f0f0f;
  --brand-panel-strong: #1a1a1a;
  --app-bg: radial-gradient(circle at top left, rgba(10, 10, 10, 0.99), rgba(5, 5, 5, 0.99) 50%, rgba(0, 0, 0, 0.99));
  --panel-grad-start: rgba(20, 20, 20, 0.98);
  --panel-grad-end: rgba(15, 15, 15, 0.98);
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-bg-strong: rgba(255, 255, 255, 0.06);
}

:root[data-theme='dark'][data-theme-variant='slate'] {
  --brand-red: #b83a3a;
  --brand-teal: #3d9b8f;
  --brand-ink: #e8e8e8;
  --brand-panel: #2a2a2a;
  --brand-panel-strong: #323232;
  --brand-border: #424242;
  --app-bg: radial-gradient(circle at top left, rgba(32, 32, 32, 0.99), rgba(24, 24, 24, 0.98) 50%, rgba(20, 20, 20, 0.98));
  --panel-grad-start: rgba(40, 40, 40, 0.96);
  --panel-grad-end: rgba(32, 32, 32, 0.96);
  --input-bg: rgba(255, 255, 255, 0.04);
  --input-bg-strong: rgba(255, 255, 255, 0.07);
}

:root[data-theme='light'][data-theme-variant='airy'] {
  --brand-panel: #fafafa;
  --brand-panel-strong: #f5f5f5;
  --brand-border: #e8e8e8;
  --app-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(240, 245, 240, 0.5));
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-bg-strong: rgba(255, 255, 255, 0.95);
}

/* ===== DARK MODE REFINEMENTS ===== */

/* Drawer header styling in dark mode - make border visible */
:root[data-theme='dark'] .drawer-head {
  border-bottom-color: rgba(255, 245, 220, 0.14);
}

/* Drawer section dividers in dark mode */
:root[data-theme='dark'] .drawer-section {
  border-bottom-color: rgba(255, 245, 220, 0.12);
}

/* Error messages readability in dark mode */
:root[data-theme='dark'] .app-notice.is-error {
  background: rgba(99, 0, 0, 0.16);
  border-color: rgba(255, 100, 100, 0.28);
}

:root[data-theme='dark'] #appNoticeText {
  color: #fff5dc;
}

/* Remove underlines from links in dark mode */
:root[data-theme='dark'] .detail-link,
:root[data-theme='dark'] .meta-link-row a {
  text-decoration: none;
}

:root[data-theme='dark'] .detail-link:hover,
:root[data-theme='dark'] .meta-link-row a:hover {
  text-decoration: none;
}

/* Hide Instagram logo icon */
.instagram-link-logo {
  display: none;
}

/* Status icon styling */
.status-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Plus button background - remove harsh color */
.board-column-plus:hover {
  background: rgba(255, 245, 220, 0.08);
}

:root[data-theme='dark'] .board-column-plus:hover {
  background: rgba(255, 245, 220, 0.08);
}

/* Month menu dark mode styling */
:root[data-theme='dark'] #gridMonthMenu .floating-menu-option {
  background: rgba(255, 245, 220, 0.08);
  border-color: rgba(255, 245, 220, 0.16);
  color: #fff5dc;
}

:root[data-theme='dark'] #gridMonthMenu .floating-menu-option:hover,
:root[data-theme='dark'] #gridMonthMenu .floating-menu-option.is-active {
  background: rgba(255, 245, 220, 0.16);
  border-color: rgba(255, 245, 220, 0.32);
  color: #fff5dc;
}

/* ===== GRID & TABLE ENHANCEMENTS ===== */

.grid-row.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

.sticky-filter-bar {
  position: sticky;
  top: 0;
  background: var(--brand-panel);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
}

/* ===== BULK OPERATIONS ===== */

.bulk-selection-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #0a5b55;
  color: #fffad9;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  animation: slideUp var(--dur-mid) var(--ease-soft);
}

.bulk-selection-count {
  font-size: 14px;
  font-weight: 500;
  color: #fffad9;
}

.bulk-action-button {
  padding: 8px 12px;
  background: rgba(255,250,217,0.15);
  color: #fffad9;
  border: 1px solid rgba(255,250,217,0.25);
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--dur-mid) var(--ease-standard);
}

.bulk-action-button:hover {
  background: rgba(255,250,217,0.25);
  transform: translateY(-1px);
}

.bulk-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== ACTIVITY FEED ===== */

.activity-feed {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  padding: 12px;
  border-left: 3px solid var(--brand-border);
  margin-bottom: 8px;
  background: rgba(99, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  font-size: 12px;
  animation: slideUp var(--dur-mid) var(--ease-soft);
}

.activity-item.is-new {
  border-left-color: var(--brand-teal);
  background: rgba(10, 91, 85, 0.05);
}

.activity-timestamp {
  color: var(--brand-muted);
  font-size: 11px;
  margin-top: 4px;
}

/* Workspace search bar — collapsed icon, expands on click */
.workspace-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 0 0 4px;
}

.workspace-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(99, 0, 0, 0.15);
  border-radius: var(--radius-btn);
  background: var(--brand-panel);
  color: var(--brand-muted);
  cursor: pointer;
  transition: background 150ms var(--ease-soft), border-color 150ms var(--ease-soft);
  flex-shrink: 0;
}

.workspace-search-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-search-toggle:hover {
  background: var(--brand-panel-strong);
  border-color: rgba(99, 0, 0, 0.25);
}

:root[data-theme='dark'] .workspace-search-toggle {
  border-color: rgba(255, 245, 220, 0.12);
}

:root[data-theme='dark'] .workspace-search-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 245, 220, 0.2);
}

/* Hidden by default — shown when .is-expanded */
.workspace-search-bar .workspace-search-input {
  width: 0;
  padding: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
  transition: width 220ms var(--ease-soft), opacity 180ms var(--ease-soft), padding 220ms var(--ease-soft), border 180ms var(--ease-soft);
  border-radius: var(--radius-btn);
  background: var(--brand-panel);
  color: var(--brand-ink);
  font-size: 13px;
  height: 34px;
  margin-left: 0;
}

.workspace-search-bar.is-expanded .workspace-search-input {
  width: 220px;
  padding: 0 10px;
  border: 1px solid rgba(99, 0, 0, 0.2);
  opacity: 1;
  pointer-events: auto;
  margin-left: 6px;
}

.workspace-search-bar.is-expanded .workspace-search-input:focus {
  outline: none;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(65, 163, 154, 0.12);
}

.workspace-search-input::placeholder {
  color: var(--brand-muted);
  opacity: 0.6;
}

:root[data-theme='dark'] .workspace-search-bar.is-expanded .workspace-search-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 245, 220, 0.15);
}

:root[data-theme='dark'] .workspace-search-bar.is-expanded .workspace-search-input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(65, 163, 154, 0.15);
}

/* Expanded state hides the toggle icon */
.workspace-search-bar.is-expanded .workspace-search-toggle {
  border-color: var(--brand-teal);
  color: var(--brand-teal);
}

.workspace-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(99, 0, 0, 0.1);
  color: var(--brand-ink);
  font-size: 14px;
  cursor: pointer;
  margin-left: 4px;
  opacity: 0.6;
  transition: opacity 150ms var(--ease-soft), background 150ms var(--ease-soft);
}

.workspace-search-clear:hover {
  opacity: 1;
  background: rgba(99, 0, 0, 0.18);
}

:root[data-theme='dark'] .workspace-search-clear {
  background: rgba(255, 245, 220, 0.1);
}

:root[data-theme='dark'] .workspace-search-clear:hover {
  background: rgba(255, 245, 220, 0.18);
}

/* Dark mode: no underlines on links */
:root[data-theme='dark'] a[href] {
  text-decoration: none;
}

/* Improved button contrast in dark mode */
:root[data-theme='dark'] button:not([class*='no-style']) {
  transition: background-color 150ms var(--ease-soft), box-shadow 150ms var(--ease-soft);
}

:root[data-theme='dark'] button[type='button']:not(.muted):not([disabled]):not([class*='icon-btn']):hover {
  background-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 245, 220, 0.2);
}

:root[data-theme='dark'] button[type='submit']:not([disabled]) {
  background-color: rgba(65, 163, 154, 0.2);
  border: 1px solid rgba(65, 163, 154, 0.4);
  color: rgba(255, 245, 220, 0.95);
}

:root[data-theme='dark'] button[type='submit']:not([disabled]):hover {
  background-color: rgba(65, 163, 154, 0.35);
  border-color: rgba(65, 163, 154, 0.6);
  box-shadow: 0 0 8px rgba(65, 163, 154, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── CRM ─────────────────────────────────────────────────────────────────── */

.crm-sub-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.crm-sub-btn {
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 2px);
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-muted);
  transition: color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard);
}

.crm-sub-btn:hover {
  border-color: rgba(99, 0, 0, 0.18);
  color: var(--brand-red);
  background: rgba(99, 0, 0, 0.04);
}

.crm-sub-btn.is-active {
  border-color: rgba(99, 0, 0, 0.2);
  background: rgba(99, 0, 0, 0.08);
  color: var(--brand-red);
  font-weight: 600;
}

.crm-tab-panel { display: block; }
.crm-tab-panel.hidden { display: none; }

.crm-pipeline-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(22, 22, 22, 0.04);
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.crm-filter-pills {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.crm-filter-pill {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid rgba(22, 22, 22, 0.15);
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  user-select: none;
}

.crm-filter-pill.is-active {
  background: var(--brand-ink);
  border-color: var(--brand-ink);
  color: #fff;
}

.crm-filter-pill:not(.is-active):hover {
  background: rgba(22, 22, 22, 0.06);
}

.crm-pipeline-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.crm-stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(22, 22, 22, 0.12);
}

.crm-summary-label {
  color: var(--brand-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-summary-value {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-red);
}

.crm-value-green {
  color: #1a7a4a;
}

:root[data-theme='dark'] .crm-value-green {
  color: #4cba7a;
}

:root[data-theme='dark'] .crm-filter-pill {
  border-color: rgba(255, 255, 255, 0.15);
}

:root[data-theme='dark'] .crm-filter-pill.is-active {
  background: rgba(255, 245, 220, 0.9);
  border-color: rgba(255, 245, 220, 0.9);
  color: #1a1a1a;
}

:root[data-theme='dark'] .crm-filter-pill:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme='dark'] .crm-stat-divider {
  background: rgba(255, 255, 255, 0.12);
}

.crm-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  table-layout: fixed;
}

.crm-table-wrap {
  overflow-x: auto;
}

.crm-table th,
.crm-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(22, 22, 22, 0.08);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  vertical-align: top;
}

.crm-table thead th {
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  background: rgba(255, 252, 236, 0.92);
  font-weight: 600;
}

.crm-table tbody tr:last-child td {
  border-bottom: 0;
}

.crm-table tbody tr td {
  transition: background-color 0.15s ease;
}

.crm-table tbody tr:hover td {
  background: rgba(99, 0, 0, 0.025);
}

.crm-row-editing td {
  background: rgba(255, 252, 236, 0.7) !important;
}

.crm-notes-cell {
  max-width: 300px;
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

/* Inline-editable cells */
.crm-table td.crm-editable {
  cursor: pointer;
  transition: background 0.15s;
}
.crm-table td.crm-editable:hover {
  background: rgba(22, 22, 22, 0.04);
}
.crm-table td.crm-editing {
  padding: 4px 6px;
  background: rgba(255, 252, 236, 0.7) !important;
  white-space: normal !important;
}
.crm-table td.crm-editing input,
.crm-table td.crm-editing textarea,
.crm-table td.crm-editing select {
  width: 100%;
  box-sizing: border-box;
  display: block;
}
.crm-table td.crm-editing textarea {
  min-height: 60px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
}

/* Delete column */
.crm-delete-cell {
  width: 32px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.crm-row:hover .crm-delete-cell {
  opacity: 1;
}
.crm-delete-icon {
  background: none;
  border: none;
  color: var(--brand-red);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.crm-delete-icon:hover {
  opacity: 1;
  background: rgba(192, 57, 43, 0.08);
}

.crm-inline-input {
  width: 100%;
  min-width: 80px;
  padding: 3px 6px;
  border: 1px solid rgba(22, 22, 22, 0.18);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.crm-inline-input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.18);
  outline: none;
}

.crm-inline-select {
  padding: 3px 6px;
  border: 1px solid rgba(22, 22, 22, 0.18);
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.crm-inline-select:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(10, 91, 85, 0.18);
  outline: none;
}

/* Stage badges */
.crm-stage-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.crm-stage-new-lead      { background: rgba(22,22,22,0.07); color: #555; }
.crm-stage-form-sent     { background: #cff5f6; color: #0b6972; }
.crm-stage-call-booked   { background: #0d5945; color: #fff; }
.crm-stage-proposal-sent { background: #1a4c80; color: #fff; }
.crm-stage-negotiating   { background: #5c1a1a; color: #fff; }
.crm-stage-follow-up-due { background: #c41e1e; color: #fff; }
.crm-stage-closed-won    { background: #111; color: #fff; }
.crm-stage-closed-lost   { background: rgba(22,22,22,0.1); color: #888; }
.crm-stage-on-hold       { background: #4a5568; color: #fff; }

/* Client status badges */
.crm-status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.crm-status-active  { background: rgba(10,91,85,0.12); color: #0a5b55; }
.crm-status-paused  { background: rgba(146,64,14,0.12); color: #92400e; }
.crm-status-churned { background: rgba(22,22,22,0.08); color: #888; }

/* Revenue dashboard */
.crm-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.crm-metric-card {
  padding: 14px 16px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.crm-metric-card:hover {
  border-color: rgba(22, 22, 22, 0.16);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(22, 22, 22, 0.06);
}

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

.crm-metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-text, #111);
  line-height: 1.1;
}

.crm-stage-legend {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(22, 22, 22, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
}

.crm-legend-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
}

.crm-legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Dark mode */
:root[data-theme='dark'] .crm-table {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

:root[data-theme='dark'] .crm-table th,
:root[data-theme='dark'] .crm-table td {
  border-color: rgba(255,255,255,0.07);
}

:root[data-theme='dark'] .crm-table thead th {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
}

:root[data-theme='dark'] .crm-table tbody tr:hover td {
  background: rgba(255,255,255,0.04);
}

:root[data-theme='dark'] .crm-row-editing td {
  background: rgba(255,255,255,0.06) !important;
}

:root[data-theme='dark'] .crm-inline-input,
:root[data-theme='dark'] .crm-inline-select {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
  color: inherit;
}

:root[data-theme='dark'] .crm-metric-card,
:root[data-theme='dark'] .crm-stage-legend {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

:root[data-theme='dark'] .crm-pipeline-summary {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
}

:root[data-theme='dark'] .crm-sub-btn {
  color: rgba(255,255,255,0.5);
}

:root[data-theme='dark'] .crm-sub-btn.is-active {
  background: rgba(99,0,0,0.2);
  color: #e06060;
  border-color: rgba(99,0,0,0.3);
}

:root[data-theme='dark'] .crm-table td.crm-editable:hover {
  background: rgba(255,255,255,0.06);
}

:root[data-theme='dark'] .crm-table td.crm-editing {
  background: rgba(255,255,255,0.08) !important;
}

:root[data-theme='dark'] .crm-delete-icon {
  color: #e06060;
}

/* CRM stage badge dark mode overrides */
:root[data-theme='dark'] .crm-stage-new-lead      { background: rgba(255,255,255,0.1); color: #ccc; }
:root[data-theme='dark'] .crm-stage-form-sent      { background: rgba(11,105,114,0.3); color: #7ee8ed; }
:root[data-theme='dark'] .crm-stage-call-booked    { background: rgba(13,89,69,0.5); color: #6ee7b7; }
:root[data-theme='dark'] .crm-stage-proposal-sent  { background: rgba(26,76,128,0.5); color: #93c5fd; }
:root[data-theme='dark'] .crm-stage-negotiating    { background: rgba(92,26,26,0.5); color: #fca5a5; }
:root[data-theme='dark'] .crm-stage-follow-up-due  { background: rgba(196,30,30,0.4); color: #fca5a5; }
:root[data-theme='dark'] .crm-stage-closed-won     { background: rgba(255,255,255,0.15); color: #fff; }
:root[data-theme='dark'] .crm-stage-closed-lost    { background: rgba(255,255,255,0.06); color: #999; }
:root[data-theme='dark'] .crm-stage-on-hold        { background: rgba(74,85,104,0.5); color: #cbd5e0; }

/* CRM client status badge dark mode overrides */
:root[data-theme='dark'] .crm-status-active  { background: rgba(10,91,85,0.3); color: #6ee7b7; }
:root[data-theme='dark'] .crm-status-paused  { background: rgba(146,64,14,0.3); color: #fbbf24; }
:root[data-theme='dark'] .crm-status-churned { background: rgba(255,255,255,0.08); color: #999; }

/* Admin search / date inputs */
.admin-search-input,
.admin-date-input {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 7px 12px;
  border: 1px solid rgba(22,22,22,0.15);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--surface, #fff);
  color: inherit;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.admin-search-input:focus,
.admin-date-input:focus {
  border-color: rgba(22,22,22,0.35);
}
:root[data-theme='dark'] .admin-search-input,
:root[data-theme='dark'] .admin-date-input {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}
:root[data-theme='dark'] .admin-search-input:focus,
:root[data-theme='dark'] .admin-date-input:focus {
  border-color: rgba(255,255,255,0.35);
}
.admin-date-input {
  display: inline-block;
  width: auto;
  max-width: 180px;
  margin-left: 8px;
  margin-bottom: 0;
}

/* CRM search + export bar */
.crm-search-export-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.crm-search-export-bar .admin-search-input {
  margin-bottom: 0;
  flex: 1;
}

/* Approved email batch bar */
.approved-email-batch-bar {
  margin-bottom: 8px;
}
.approved-email-checkbox {
  margin-right: 8px;
  cursor: pointer;
}

/* Readiness progress bar */
.admin-readiness-progress {
  margin-bottom: 14px;
}
.admin-readiness-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-readiness-bar-track {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: rgba(22,22,22,0.08);
  overflow: hidden;
}
:root[data-theme='dark'] .admin-readiness-bar-track {
  background: rgba(255,255,255,0.1);
}
.admin-readiness-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: #0d5945;
  transition: width 0.3s;
}
:root[data-theme='dark'] .admin-readiness-bar-fill {
  background: #6ee7b7;
}

/* Admin dashboard charts */
.admin-chart-section {
  margin-top: 16px;
  margin-bottom: 8px;
}
.admin-chart-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.admin-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-bar-label {
  width: 110px;
  text-align: right;
  font-size: 0.78rem;
  color: inherit;
  flex-shrink: 0;
}
.admin-bar-track {
  flex: 1;
  height: 18px;
  background: rgba(22,22,22,0.05);
  border-radius: 4px;
  overflow: hidden;
}
:root[data-theme='dark'] .admin-bar-track {
  background: rgba(255,255,255,0.08);
}
.admin-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}
.admin-bar-value {
  width: 36px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* CRM validation error */
.crm-inline-input.crm-input-error {
  border-color: #c41e1e;
  box-shadow: 0 0 0 1px rgba(196,30,30,0.3);
}

/* ── Activity log ─────────────────────────────────────────────────────────── */
.admin-activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.admin-activity-list {
  max-height: 560px;
  overflow-y: auto;
}

/* ── Email Templates ──────────────────────────────────────────────────────── */
.admin-email-templates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-email-template-card {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 14px;
}
.admin-email-template-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-email-template-head > div {
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-email-template-editor {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-email-template-editor textarea {
  font-family: monospace;
  font-size: 0.82rem;
}

/* ── CRM Deal History Timeline ────────────────────────────────────────────── */
.crm-history-row {
  background: var(--color-surface-alt, #f8fafc);
}
.crm-history-container {
  padding: 12px 16px 12px 24px;
}
.crm-history-timeline {
  position: relative;
  padding-left: 18px;
  border-left: 2px solid var(--color-border, #cbd5e1);
}
.crm-history-entry {
  position: relative;
  padding: 6px 0 6px 12px;
}
.crm-history-dot {
  position: absolute;
  left: -24px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent, #0d5945);
  border: 2px solid var(--color-surface, #fff);
}
.crm-history-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.crm-history-content span {
  font-size: 0.82rem;
}

/* ── Bulk Selection ────────────────────────────────────────────────────────── */
.bulk-selection-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #0a5b55;
  color: #fffad9;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.bulk-selection-count { font-weight: 600; color: #fffad9; }
.bulk-action-button {
  background: rgba(255,250,217,0.15);
  color: #fffad9;
  border: 1px solid rgba(255,250,217,0.25);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.bulk-action-button:hover { background: rgba(255,250,217,0.25); }
.bulk-action-button.btn-danger { background: rgba(200,50,50,0.8); color: #fff; border-color: rgba(200,50,50,0.8); }
.bulk-action-button.btn-danger:hover { background: rgba(200,50,50,0.95); }
.bulk-checkbox { cursor: pointer; width: 16px; height: 16px; accent-color: var(--brand-teal); }

/* Notion-style hover checkboxes outside the grid */
.grid-row td:first-child {
  position: relative;
}
.grid-row-checkbox-wrap {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-row:hover .grid-row-checkbox-wrap,
.grid-row-checkbox-wrap.is-checked {
  opacity: 1;
  pointer-events: auto;
}
.bulk-status-menu .floating-menu-card { min-width: 160px; }

/* ── Offline Bar ───────────────────────────────────────────────────────────── */
.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #b91c1c;
  color: #fff;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}
body.is-offline { padding-top: 32px; }

/* ── Activity Drawer ───────────────────────────────────────────────────────── */
.activity-drawer-toggle { margin-left: 4px; }
.activity-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: linear-gradient(180deg, var(--panel-grad-start), var(--panel-grad-end));
  border-left: 1px solid rgba(22, 22, 22, 0.1);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  box-shadow: -14px 0 34px rgba(22, 22, 22, 0.14);
  transition: transform 0.2s ease;
}
:root[data-theme='dark'] .activity-drawer {
  background: rgba(33, 33, 33, 0.98) !important;
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}
:root[data-theme='dark'] .activity-drawer-head {
  border-color: rgba(255, 245, 220, 0.18) !important;
  color: #fff5dc !important;
}
:root[data-theme='dark'] .activity-drawer-item {
  border-color: rgba(255, 245, 220, 0.10) !important;
}
:root[data-theme='dark'] .activity-drawer-topline {
  color: #fff5dc !important;
}
:root[data-theme='dark'] .activity-drawer-desc {
  color: rgba(255, 245, 220, 0.68) !important;
}
:root[data-theme='dark'] .activity-type-filter {
  background: rgba(255, 245, 220, 0.1) !important;
  color: #fff5dc !important;
  border-color: rgba(255, 245, 220, 0.34) !important;
}
.activity-drawer.hidden { display: none; }
.activity-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--brand-border);
}
.activity-drawer-head h4 { margin: 0; font-size: 0.95rem; }
.activity-drawer-head-actions { display: flex; align-items: center; gap: 8px; }
.activity-type-filter {
  font-size: 0.8rem;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--brand-border);
  background: var(--input-bg);
  color: var(--brand-ink);
}
.activity-drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.activity-drawer-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(222, 212, 177, 0.5);
}
.activity-drawer-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.activity-drawer-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent, #0d5945);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-drawer-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-drawer-topline { font-size: 0.82rem; }
.activity-drawer-desc { font-size: 0.8rem; color: var(--brand-muted); }

/* ── CRM Board / Kanban View ─────────────────────────────────────────────── */
.crm-view-toggle { display: flex; gap: 4px; }
.crm-toggle-btn { padding: 5px 12px; font-size: 12px; font-weight: 600; border: 1px solid rgba(22,22,22,0.15); border-radius: 6px; background: transparent; color: var(--brand-ink); cursor: pointer; transition: all 0.15s; }
.crm-toggle-btn.is-active { background: var(--brand-teal, #0a5b55); color: #fff; border-color: var(--brand-teal, #0a5b55); }

.crm-pipeline-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0;
  min-height: 400px;
}
.crm-board-column {
  min-width: 220px;
  max-width: 260px;
  flex-shrink: 0;
  background: rgba(22,22,22,0.03);
  border-radius: 8px;
  padding: 10px;
}
.crm-board-column.drag-over {
  background: rgba(10,91,85,0.06);
}
.crm-board-column-header {
  font-weight: 600;
  font-size: 13px;
  padding: 6px 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crm-board-column-count {
  background: rgba(22,22,22,0.08);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
}
.crm-board-card {
  background: #fff;
  border: 1px solid rgba(22,22,22,0.1);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s;
}
.crm-board-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.crm-board-card.is-dragging {
  opacity: 0.5;
}
.crm-board-card-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}
.crm-board-card-value {
  font-size: 12px;
  color: #666;
}
.crm-board-card-date {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
.crm-board-drop-indicator {
  height: 3px;
  background: var(--brand-teal, #0a5b55);
  border-radius: 2px;
  margin: 4px 0;
}

/* CRM Board dark mode */
:root[data-theme='dark'] .crm-board-column { background: rgba(255,255,255,0.04); }
:root[data-theme='dark'] .crm-board-column.drag-over { background: rgba(10,91,85,0.15); }
:root[data-theme='dark'] .crm-board-card { background: #2a2a2a; border-color: rgba(255,255,255,0.1); }
:root[data-theme='dark'] .crm-board-card-value { color: #aaa; }
:root[data-theme='dark'] .crm-board-card-date { color: #888; }
:root[data-theme='dark'] .crm-board-column-count { background: rgba(255,255,255,0.08); }
:root[data-theme='dark'] .crm-toggle-btn { border-color: rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); }

/* ─────────────────────────────────────────────────────────────
   PROFILE PAGE
   ───────────────────────────────────────────────────────────── */

.profile-page-body {
  min-height: 100vh;
  background: var(--app-bg);
}

.profile-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

.profile-page-head {
  margin-bottom: 32px;
}

.profile-page-title {
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 700;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.03em;
  color: var(--brand-ink);
}

/* Section layout */
.profile-section {
  background: linear-gradient(180deg, var(--panel-grad-start), var(--panel-grad-end));
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: start;
}

.profile-section-label {
  padding-top: 4px;
}

.profile-section-title {
  font-family: 'Sora', 'Avenir Next', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-section-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Avatar */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--brand-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid var(--brand-border);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-initials {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: #fff;
  letter-spacing: -0.02em;
}

/* Fields */
.profile-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-ink);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
}

.profile-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: var(--input-bg-strong);
  color: var(--brand-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: border-color var(--dur-fast) var(--ease-standard);
}

.profile-input:focus {
  outline: none;
  border-color: var(--brand-teal);
}

.profile-select {
  cursor: pointer;
}

.profile-save-btn {
  align-self: flex-start;
}

.profile-field-msg {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.profile-msg-ok {
  background: rgba(10, 91, 85, 0.1);
  color: var(--brand-teal);
  border: 1px solid rgba(10, 91, 85, 0.2);
}

.profile-msg-error {
  background: rgba(99, 0, 0, 0.08);
  color: var(--brand-red);
  border: 1px solid rgba(99, 0, 0, 0.15);
}

/* Sessions */
.profile-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
}

.profile-session-current {
  border-color: var(--brand-teal);
  background: rgba(10, 91, 85, 0.06);
}

.profile-session-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.profile-session-device {
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-session-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--brand-teal);
  color: #fff;
  letter-spacing: 0.02em;
}

.profile-session-meta {
  font-size: 12px;
  color: var(--brand-muted);
}

/* Theme cards */
.profile-theme-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.profile-theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: none;
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
  overflow: hidden;
}

.profile-theme-card:hover {
  border-color: var(--brand-teal);
}

.profile-theme-card-active {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(10, 91, 85, 0.15);
}

.profile-theme-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-ink);
  padding-bottom: 12px;
}

/* Theme preview skeleton */
.theme-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
  position: relative;
}

.theme-preview-light { background: #fffad9; }
.theme-preview-dark  { background: #161616; }
.theme-preview-auto  { display: flex; position: relative; overflow: hidden; }

.tp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  height: 18px;
}

.theme-preview-light .tp-topbar { background: rgba(255,255,255,0.7); border-bottom: 1px solid #ded4b1; }
.theme-preview-dark  .tp-topbar { background: rgba(36,36,36,0.96); border-bottom: 1px solid #3a3a3a; }

.tp-logo {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.theme-preview-light .tp-logo { background: #630000; }
.theme-preview-dark  .tp-logo { background: #c95a5a; }

.tp-topbar-right { display: flex; align-items: center; gap: 4px; }

.tp-pill {
  width: 24px; height: 7px;
  border-radius: 4px;
}
.theme-preview-light .tp-pill { background: #ded4b1; }
.theme-preview-dark  .tp-pill { background: #3a3a3a; }

.tp-avatar {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.theme-preview-light .tp-avatar { background: #0a5b55; }
.theme-preview-dark  .tp-avatar { background: #41a39a; }

.tp-body {
  display: flex;
  flex: 1;
  padding: 6px;
  gap: 5px;
  height: calc(100% - 18px);
}

.tp-sidebar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 30%;
}

.tp-ws-card {
  height: 12px;
  border-radius: 3px;
}
.theme-preview-light .tp-ws-card { background: rgba(0,0,0,0.08); }
.theme-preview-dark  .tp-ws-card { background: rgba(255,255,255,0.08); }
.theme-preview-light .tp-ws-card-active { background: rgba(10,91,85,0.25); }
.theme-preview-dark  .tp-ws-card-active { background: rgba(65,163,154,0.3); }

.tp-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.tp-heading {
  height: 10px;
  border-radius: 3px;
  width: 60%;
}
.theme-preview-light .tp-heading { background: rgba(0,0,0,0.18); }
.theme-preview-dark  .tp-heading { background: rgba(255,255,255,0.2); }

.tp-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 2px;
}

.tp-tab {
  height: 7px;
  width: 22px;
  border-radius: 3px;
}
.theme-preview-light .tp-tab { background: rgba(0,0,0,0.08); }
.theme-preview-dark  .tp-tab { background: rgba(255,255,255,0.08); }
.theme-preview-light .tp-tab-active { background: #630000; }
.theme-preview-dark  .tp-tab-active { background: #c95a5a; }

.tp-row {
  height: 7px;
  border-radius: 3px;
  width: 90%;
}
.theme-preview-light .tp-row { background: rgba(0,0,0,0.07); }
.theme-preview-dark  .tp-row { background: rgba(255,255,255,0.07); }

.tp-row-short { width: 60%; }

/* Auto (split) preview */
.tp-auto-half {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tp-auto-light { background: #fffad9; }
.tp-auto-dark  { background: #161616; }

.tp-auto-light .tp-topbar { background: rgba(255,255,255,0.7); border-bottom: 1px solid #ded4b1; }
.tp-auto-dark  .tp-topbar { background: rgba(36,36,36,0.96); border-bottom: 1px solid #3a3a3a; }
.tp-auto-light .tp-logo { background: #630000; }
.tp-auto-dark  .tp-logo { background: #c95a5a; }
.tp-auto-light .tp-avatar { background: #0a5b55; }
.tp-auto-dark  .tp-avatar { background: #41a39a; }
.tp-auto-light .tp-heading { background: rgba(0,0,0,0.18); }
.tp-auto-dark  .tp-heading { background: rgba(255,255,255,0.2); }
.tp-auto-light .tp-row { background: rgba(0,0,0,0.08); }
.tp-auto-dark  .tp-row { background: rgba(255,255,255,0.08); }

.tp-auto-divider {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255,255,255,0.5);
  transform: translateX(-50%);
  z-index: 2;
}

/* Notifications */
.profile-notif-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--brand-border);
}

.profile-notif-group:last-of-type { border-bottom: none; padding-bottom: 0; }

.profile-notif-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-muted);
}

.profile-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.profile-toggle-wrap { flex-shrink: 0; margin-top: 2px; }
.profile-toggle-input { display: none; }

.profile-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--brand-border);
  position: relative;
  transition: background var(--dur-fast) var(--ease-standard);
}

.profile-toggle-input:checked + .profile-toggle-track {
  background: var(--brand-teal);
}

.profile-toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-fast) var(--ease-standard);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.profile-toggle-input:checked ~ .profile-toggle-track .profile-toggle-thumb,
.profile-toggle-input:checked + .profile-toggle-track .profile-toggle-thumb {
  transform: translateX(18px);
}

.profile-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-toggle-text strong { font-size: 14px; font-weight: 600; }
.profile-toggle-text .muted { font-size: 13px; }

/* Danger zone */
.profile-section-danger {
  border-color: rgba(99, 0, 0, 0.2);
}

.profile-danger-title { color: var(--brand-red); }

.link-btn-danger {
  background: transparent;
  color: var(--brand-red);
  border: 1px solid rgba(99, 0, 0, 0.3);
  border-radius: var(--radius-btn);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  display: inline-block;
}
.link-btn-danger:hover { background: rgba(99,0,0,0.08); border-color: var(--brand-red); }

.profile-delete-confirm {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(99,0,0,0.2);
  border-radius: var(--radius-md);
  background: rgba(99,0,0,0.04);
}

/* Logout row */
.profile-logout-row {
  text-align: center;
  margin-top: 24px;
}

.profile-logout-btn {
  font-size: 14px;
  color: var(--brand-muted);
}

/* Crop modal */
.profile-crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.profile-crop-card {
  background: var(--brand-panel);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-soft);
}

.profile-crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.profile-crop-title { font-weight: 700; font-size: 16px; }

.profile-crop-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #111;
  margin-bottom: 14px;
}

.profile-crop-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: grab;
}

.profile-crop-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-crop-zoom {
  flex: 1;
  accent-color: var(--brand-teal);
}


/* Dark mode overrides for profile page */
:root[data-theme='dark'] .profile-section {
  border-color: #3a3a3a;
}
:root[data-theme='dark'] .profile-input {
  background: rgba(255,255,255,0.06);
  border-color: #3a3a3a;
  color: var(--brand-ink);
}
:root[data-theme='dark'] .profile-session-row {
  background: rgba(255,255,255,0.04);
  border-color: #3a3a3a;
}
:root[data-theme='dark'] .profile-session-current {
  background: rgba(65,163,154,0.1);
  border-color: rgba(65,163,154,0.4);
}
:root[data-theme='dark'] .profile-toggle-track { background: #3a3a3a; }
:root[data-theme='dark'] .profile-theme-card { border-color: #3a3a3a; }
:root[data-theme='dark'] .profile-crop-card { background: #1e1e1e; }
:root[data-theme='dark'] .link-btn-danger { color: #e87b7b; border-color: rgba(200,100,100,0.3); }
:root[data-theme='dark'] .link-btn-danger:hover { background: rgba(200,100,100,0.1); }
:root[data-theme='dark'] .profile-delete-confirm { background: rgba(200,100,100,0.05); border-color: rgba(200,100,100,0.2); }

/* ── Profile page responsive ──────────────────────────────────────── */
/* Tablet: narrow left column */
@media (max-width: 860px) {
  .profile-shell {
    padding: 24px 20px 60px;
  }
  .profile-section {
    grid-template-columns: 160px 1fr;
    gap: 24px;
    padding: 24px;
  }
}

/* Mobile: collapse to single column */
@media (max-width: 640px) {
  .profile-shell {
    padding: 20px 16px 60px;
  }
  .profile-section {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 18px;
  }
  .profile-section-label {
    padding-top: 0;
  }
}

/* ── Instagram Admin Panel ──────────────────────────────────────────────────── */
.ig-settings-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  padding: 20px 24px;
}
.ig-card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted, #6b7280);
  margin: 0 0 10px;
}
.ig-key-status {
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 20px;
}
.ig-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ig-ws-table {
  width: 100%;
}
.ig-ws-table td {
  vertical-align: middle;
  padding: 10px 8px;
}
.ig-link-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ig-link-input {
  font-size: 12px !important;
}

/* dark mode */
:root[data-theme='dark'] .ig-settings-card {
  background: var(--color-surface-dark, #1f2937);
  border-color: var(--color-border-dark, #374151);
}

/* ── Analytics Dashboard v2 ─────────────────────────────────────────────────── */
/* KPI row */
.an-kpi-row { display: grid; grid-template-columns: repeat(7,1fr); gap: 8px; margin: 12px 0 6px; }
@media(max-width:1280px){ .an-kpi-row { grid-template-columns: repeat(4,1fr); } }
@media(max-width:1100px){ .an-kpi-row { grid-template-columns: repeat(3,1fr); } }
@media(max-width:640px){ .an-kpi-row { grid-template-columns: repeat(2,1fr); } }
.an-kpi { background: var(--brand-panel); border: 1px solid var(--brand-border); border-radius: var(--radius-lg); padding: 14px 14px 12px; min-width: 0; }
.an-kpi-val { overflow-wrap: anywhere; }
.an-kpi-lbl { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-muted); margin-bottom: 6px; }
.an-kpi-val { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.an-kpi-delta { display: inline-flex; align-items: center; gap: 3px; margin-top: 5px; padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
.an-kpi-delta.up { background: rgba(10,91,85,0.1); color: var(--brand-teal); }
.an-kpi-delta.dn { background: rgba(99,0,0,0.1); color: var(--brand-red); }
.an-kpi-delta.nt { background: rgba(90,82,71,0.08); color: var(--brand-muted); }
.calendar-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .calendar-layout { grid-template-columns: 1fr; } .calendar-mini-side { display:none; } }
.calendar-mini-side { background: var(--brand-panel); border: 1px solid var(--brand-border); border-radius: var(--radius-lg); padding: 10px; position: sticky; top: 12px; max-height: calc(100vh - 100px); overflow: auto; }
.calendar-mini-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.calendar-mini-label { font-size: 0.8rem; font-weight: 700; color: var(--brand-ink); flex: 1; text-align: center; }
.calendar-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; font-size: 0.68rem; }
.calendar-mini-grid .cm-head { font-size: 0.58rem; font-weight: 700; color: var(--brand-muted); text-align: center; padding: 2px 0; text-transform: uppercase; letter-spacing: 0.04em; }
.calendar-mini-grid .cm-day { text-align: center; padding: 4px 0; border-radius: 4px; cursor: pointer; color: var(--brand-ink); position: relative; }
.calendar-mini-grid .cm-day.is-muted { color: rgba(90,82,71,0.4); }
.calendar-mini-grid .cm-day:hover { background: rgba(10,91,85,0.12); }
.calendar-mini-grid .cm-day.is-today { background: var(--brand-teal); color: #fff; font-weight: 700; }
.calendar-mini-grid .cm-day.has-videos::after { content: ''; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand-red); }
.calendar-mini-grid .cm-day.is-today.has-videos::after { background: #fff; }
.calendar-mini-upcoming { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--brand-border); font-size: 0.72rem; }
.calendar-mini-upcoming .cm-up-title { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-muted); font-weight: 700; margin-bottom: 6px; }
.calendar-mini-upcoming .cm-up-item { padding: 4px 0; border-bottom: 1px dashed var(--brand-border); cursor: pointer; }
.calendar-mini-upcoming .cm-up-item:last-child { border-bottom: none; }
.calendar-mini-upcoming .cm-up-item:hover { color: var(--brand-teal); }
.calendar-mini-upcoming .cm-up-date { font-size: 0.62rem; color: var(--brand-muted); }

.an-kpi-spark { display: block; width: 100%; height: 20px; margin-top: 6px; color: var(--brand-muted); opacity: 0.65; }
.an-kpi-spark[data-trend="up"] { color: var(--brand-teal); opacity: 0.85; }
.an-kpi-spark[data-trend="down"] { color: var(--brand-red); opacity: 0.85; }
:root[data-theme='dark'] .an-kpi-spark { opacity: 0.75; }

/* Chart toggle bar */
.an-toggle-header { display: flex; align-items: center; gap: 14px; margin: 18px 0 8px; flex-wrap: wrap; }
.an-charts-label { margin: 0 !important; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--brand-muted); flex-shrink: 0; }
.an-chart-toggle-bar { display: flex; flex-wrap: wrap; gap: 5px; }
.an-ctog { padding: 4px 12px; border-radius: 99px; font-size: 0.73rem; font-weight: 600; cursor: pointer; color: var(--brand-muted); border: 1px solid var(--brand-border); background: transparent; transition: all 0.13s; font-family: inherit; }
.an-ctog.an-ctog-active { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
.an-ctog.an-ctog-all { background: rgba(10,91,85,0.07); color: var(--brand-teal); border-color: transparent; margin-left: 4px; }
.an-ctog.an-ctog-none { background: rgba(90,82,71,0.07); color: var(--brand-muted); border-color: transparent; }
.an-ctog.an-ctog-all:hover { background: rgba(10,91,85,0.15); }
.an-ctog.an-ctog-none:hover { background: rgba(90,82,71,0.13); }

/* Charts grid */
.an-charts-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 4px; }
@media(max-width:1100px){ .an-charts-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:700px){ .an-charts-grid { grid-template-columns: 1fr; } }
/* Two distinct animations for the chart grid:
   - .an-charts-refreshed: gentle neutral fade for the initial tab-open render
   - .an-charts-just-synced: teal-tinted pulse signaling "data was just refreshed
     from Meta" — fires only on the final render after sync completes */
@keyframes an-charts-refresh-flash {
  0% { opacity: 0.4; transform: scale(0.995); }
  60% { opacity: 1; transform: scale(1.002); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes an-charts-sync-pulse {
  0% { box-shadow: 0 0 0 0 rgba(10,91,85,0); }
  20% { box-shadow: 0 0 0 8px rgba(10,91,85,0.12); }
  60% { box-shadow: 0 0 0 14px rgba(10,91,85,0.06); }
  100% { box-shadow: 0 0 0 0 rgba(10,91,85,0); }
}
.an-charts-grid.an-charts-refreshed { animation: an-charts-refresh-flash 0.55s ease-out; }
.an-charts-grid.an-charts-just-synced > * {
  animation: an-charts-refresh-flash 0.65s ease-out, an-charts-sync-pulse 1.1s ease-out;
}
.an-chart-wrap { display: contents; transition: opacity 0.25s ease; }
.an-chart-wrap.an-chart-hidden { display: none; }
.an-chart-card { padding: 16px 18px 14px; }
.an-chart-title { font-size: 0.87rem; font-weight: 700; margin-bottom: 2px; }
.an-chart-sub { font-size: 0.72rem; color: var(--brand-muted); margin-bottom: 12px; }
.an-svg-wrap { position: relative; user-select: none; overflow: visible; }
.an-chart-svg { width: 100%; overflow: hidden; display: block; }
.an-tooltip { position: absolute; pointer-events: none; opacity: 0; background: var(--brand-panel); border: 1px solid var(--brand-border); border-radius: 10px; padding: 9px 13px; font-size: 0.76rem; box-shadow: 0 8px 24px rgba(0,0,0,0.1); white-space: nowrap; transition: opacity 0.1s; z-index: 100; min-width: 120px; }
.an-tooltip.show { opacity: 1; }
.an-tt-label { font-weight: 700; margin-bottom: 5px; font-size: 0.78rem; color: var(--brand-ink); }
.an-tt-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.an-tt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.an-tt-name { color: var(--brand-muted); font-size: 0.73rem; }
.an-tt-val { font-weight: 700; margin-left: auto; padding-left: 10px; }
.an-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.an-leg-item { display: flex; align-items: center; gap: 5px; font-size: 0.71rem; color: var(--brand-muted); }
.an-leg-line { width: 16px; height: 2px; border-radius: 2px; }
.an-y-label { font-size: 8px; font-family: var(--font-body, 'Sora', sans-serif); }
.an-x-label { font-size: 8px; font-family: var(--font-body, 'Sora', sans-serif); text-anchor: middle; }

/* 2-col grid */
.an-g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media(max-width:700px){ .an-g2 { grid-template-columns: 1fr; } }

/* Conversion funnel */
.an-funnel-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--brand-border); }
.an-funnel-item:last-child { border-bottom: none; }
.an-f-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.an-f-meta { flex: 1; }
.an-f-name { font-weight: 600; font-size: 0.84rem; }
.an-f-sub { font-size: 0.7rem; color: var(--brand-muted); }
.an-f-bar-wrap { flex: 2; }
.an-f-bar-track { height: 6px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; }
.an-f-bar-fill { height: 100%; border-radius: 99px; }
.an-f-count { font-size: 1.1rem; font-weight: 700; min-width: 36px; text-align: right; }
.an-f-rate { font-size: 0.72rem; color: var(--brand-muted); min-width: 34px; text-align: right; }
.an-stat-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; border-top: 1px solid var(--brand-border); margin-top: 14px; }
.an-stat-item { text-align: center; padding: 12px 8px 9px; border-right: 1px solid var(--brand-border); }
.an-stat-item:last-child { border-right: none; }
.an-stat-lbl { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-muted); font-weight: 700; margin-bottom: 3px; }
.an-stat-val { font-size: 1rem; font-weight: 700; }
.an-stat-sub { font-size: 0.67rem; color: var(--brand-muted); margin-top: 2px; }

/* Revenue bar chart */
.an-bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.an-bar-lbl { width: 80px; flex-shrink: 0; font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-bar-track { flex: 1; height: 8px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; }
.an-bar-fill { height: 100%; border-radius: 99px; transition: width 0.7s cubic-bezier(0.2,0.7,0.2,1); }
.an-bar-v { width: 48px; text-align: right; font-weight: 700; font-size: 0.79rem; flex-shrink: 0; }
.an-bar-p { width: 32px; text-align: right; font-size: 0.71rem; color: var(--brand-muted); flex-shrink: 0; }

/* ICP */
.an-icp-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.an-icp-title { flex: 1; font-size: 0.77rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.an-icp-track { flex: 2; height: 8px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; min-width: 40px; }
.an-icp-fill { height: 100%; border-radius: 99px; background: var(--brand-teal); transition: width 0.8s cubic-bezier(0.2,0.7,0.2,1); }
.an-icp-count { width: 30px; text-align: right; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.an-icp-rate { width: 36px; text-align: right; font-size: 0.7rem; color: var(--brand-muted); flex-shrink: 0; }

/* Profile strip */
.an-ig-profile { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: rgba(90,82,71,0.04); border-radius: var(--radius-md); margin-bottom: 16px; border: 1px solid var(--brand-border); }
.an-ig-avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.an-ig-name { font-weight: 700; font-size: 0.88rem; }
.an-ig-sub { font-size: 0.7rem; color: var(--brand-muted); margin-top: 2px; }
.an-ig-stats { display: flex; gap: 20px; margin-left: auto; }
.an-ig-stat { text-align: center; }
.an-ig-stat-val { font-weight: 700; font-size: 0.9rem; }
.an-ig-stat-lbl { font-size: 0.63rem; color: var(--brand-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* Feed header row */
.an-feed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.an-handle-display { font-weight: 700; font-size: 0.95rem; }
.an-open-profile { font-size: 0.75rem; color: var(--brand-muted); text-decoration: none; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--brand-border); transition: all 0.13s; display: none; }
.an-open-profile:hover { color: var(--brand-teal); border-color: var(--brand-teal); }

/* Feed controls */
.an-feed-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--brand-border); }
.an-feed-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.an-feed-pill { padding: 4px 12px; border-radius: 99px; font-size: 0.73rem; font-weight: 600; cursor: pointer; color: var(--brand-muted); border: 1px solid var(--brand-border); background: transparent; transition: all 0.13s; font-family: inherit; }
.an-feed-pill.active { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
.an-feed-sort-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.an-sort-label { font-size: 0.72rem; color: var(--brand-muted); font-weight: 600; margin-right: 2px; }
.an-sort-btn { padding: 4px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; cursor: pointer; color: var(--brand-muted); border: 1px solid var(--brand-border); background: transparent; transition: all 0.13s; font-family: inherit; }
.an-sort-btn.active { background: rgba(10,91,85,0.1); color: var(--brand-teal); border-color: var(--brand-teal); }
.an-sync-btn { font-size: 0.73rem; }

/* Reels grid – 6 columns like Instagram */
.an-reels-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 4px; }
@media(max-width:1400px){ .an-reels-grid { grid-template-columns: repeat(4,1fr); } }
@media(max-width:900px){ .an-reels-grid { grid-template-columns: repeat(3,1fr); } }
@media(max-width:600px){ .an-reels-grid { grid-template-columns: repeat(2,1fr); } }
.an-reel-card { background: var(--brand-panel); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.an-reel-video-wrap { position: relative; flex-shrink: 0; background: #111; aspect-ratio: 9/16; overflow: hidden; display: block; text-decoration: none; cursor: pointer; }
.an-reel-thumb-img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.15s; }
.an-reel-placeholder { width: 100%; height: 100%; background: linear-gradient(160deg,rgba(10,91,85,0.08),rgba(99,0,0,0.05)); }
/* Hover: dim thumbnail 10% and show play button */
.an-reel-video-wrap:hover .an-reel-thumb-img { opacity: 0.9; }
.an-reel-hover-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); opacity: 0; transition: opacity 0.15s; pointer-events: none; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.4)); }
.an-reel-video-wrap:hover .an-reel-hover-play { opacity: 1; }
/* Overlay stats on the thumbnail */
.an-reel-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,0.7)); color: #fff; display: flex; gap: 8px; font-size: 0.65rem; font-weight: 600; pointer-events: none; }
.an-reel-overlay span { display: flex; align-items: center; gap: 2px; }
/* Sort button states */
.an-sort-btn.active { background: rgba(10,91,85,0.1); color: var(--brand-teal); border-color: var(--brand-teal); }
.an-sort-btn.active.asc { background: rgba(99,0,0,0.08); color: var(--brand-red, #8b0000); border-color: var(--brand-red, #8b0000); }
.an-reels-empty { padding: 40px; text-align: center; color: var(--brand-muted); font-size: 0.83rem; grid-column: 1/-1; }
.an-sync-note { text-align: center; padding: 12px; font-size: 0.73rem; color: var(--brand-muted); border-top: 1px solid var(--brand-border); margin-top: 14px; }

/* Section label */
.an-section-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--brand-muted); margin-bottom: 10px; margin-top: 22px; }

/* sync flash animation on reel cards */
@keyframes anReelUpdated {
  0%   { box-shadow: 0 0 0 2px var(--brand-teal); opacity: 0.7; }
  50%  { box-shadow: 0 0 0 2px var(--brand-teal); opacity: 1; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}
.an-reel-card.an-reel-updated { animation: anReelUpdated 1.2s ease-out forwards; }

/* dark mode tweaks */
:root[data-theme='dark'] .an-kpi { background: var(--brand-panel); border-color: var(--brand-border); }
:root[data-theme='dark'] .an-reel-card { background: var(--brand-panel); border-color: var(--brand-border); }
:root[data-theme='dark'] .an-ig-profile { background: rgba(255,255,255,0.03); }

/* ── Analytics v2 Scoped Styles ──────────────────────────────────────────── */
#view-analytics {
  --card-bg: var(--brand-panel);
  --card-border: 1px solid var(--brand-border);
  --shadow: 0 2px 12px rgba(58,18,10,0.06);
  --radius: 14px;
}
:root[data-theme='dark'] #view-analytics {
  --shadow: 0 2px 20px rgba(0,0,0,0.25);
}

/* SECTION LABEL */
#view-analytics .slabel { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--brand-muted); margin-bottom: 10px; margin-top: 22px; }

/* KPI GRID */
#view-analytics .kpi-row { display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; margin-bottom: 4px; }
@media(max-width:1100px){ #view-analytics .kpi-row { grid-template-columns: repeat(3,1fr); } }
@media(max-width:640px){ #view-analytics .kpi-row { grid-template-columns: repeat(2,1fr); } }
#view-analytics .kpi { background: var(--card-bg); border: var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 12px; cursor: default; transition: box-shadow 0.15s; }
#view-analytics .kpi:hover { box-shadow: 0 4px 24px rgba(10,91,85,0.12); }
#view-analytics .kpi-lbl { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand-muted); margin-bottom: 6px; }
#view-analytics .kpi-val { font-size: 1.5rem; font-weight: 700; line-height: 1; }
#view-analytics .kpi-delta { display: inline-flex; align-items: center; gap: 3px; margin-top: 5px; padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
#view-analytics .up { background: rgba(10,91,85,0.1); color: var(--brand-teal); }
#view-analytics .dn { background: rgba(99,0,0,0.1); color: var(--brand-red); }
#view-analytics .nt { background: rgba(90,82,71,0.08); color: var(--brand-muted); }

/* CARD */
#view-analytics .card { background: var(--card-bg); border: var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); }
#view-analytics .card-body { padding: 18px 20px 16px; }
#view-analytics .card-title { font-size: 0.87rem; font-weight: 700; margin-bottom: 2px; }
#view-analytics .card-sub { font-size: 0.72rem; color: var(--brand-muted); margin-bottom: 14px; }

/* GRIDS */
#view-analytics .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#view-analytics .g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media(max-width:1100px){ #view-analytics .g3 { grid-template-columns: 1fr 1fr; } }
@media(max-width:700px){ #view-analytics .g2, #view-analytics .g3 { grid-template-columns: 1fr; } }

/* LINE CHART */
#view-analytics .chart-wrap { position: relative; user-select: none; }
#view-analytics .chart-svg { width: 100%; overflow: visible; display: block; }
#view-analytics .chart-tooltip { position: absolute; pointer-events: none; opacity: 0; background: var(--card-bg); border: var(--card-border); border-radius: 10px; padding: 9px 13px; font-size: 0.76rem; box-shadow: 0 8px 24px rgba(0,0,0,0.14); white-space: nowrap; transition: opacity 0.1s; z-index: 100; min-width: 120px; }
#view-analytics .chart-tooltip.show { opacity: 1; }
#view-analytics .tt-label { font-weight: 700; margin-bottom: 5px; font-size: 0.78rem; color: var(--brand-ink); }
#view-analytics .tt-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
#view-analytics .tt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
#view-analytics .tt-name { color: var(--brand-muted); font-size: 0.73rem; }
#view-analytics .tt-val { font-weight: 700; margin-left: auto; padding-left: 10px; }
#view-analytics .y-label { font-size: 8px; fill: var(--brand-muted, #5a5247); font-family: 'Sora', sans-serif; }
#view-analytics .x-label { font-size: 8px; fill: var(--brand-muted, #5a5247); font-family: 'Sora', sans-serif; text-anchor: middle; }

/* BAR CHART */
#view-analytics .bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
#view-analytics .bar-lbl { width: 88px; flex-shrink: 0; font-size: 0.78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view-analytics .bar-track { flex: 1; height: 8px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; }
#view-analytics .bar-fill { height: 100%; border-radius: 99px; transition: width 0.7s cubic-bezier(0.2,0.7,0.2,1); }
#view-analytics .bar-v { width: 48px; text-align: right; font-weight: 700; font-size: 0.79rem; flex-shrink: 0; }
#view-analytics .bar-p { width: 32px; text-align: right; font-size: 0.71rem; color: var(--brand-muted); flex-shrink: 0; }

/* FUNNEL */
#view-analytics .funnel-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: var(--card-border); }
#view-analytics .funnel-item:last-child { border-bottom: none; }
#view-analytics .f-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
#view-analytics .f-meta { flex: 1; }
#view-analytics .f-name { font-weight: 600; font-size: 0.84rem; }
#view-analytics .f-sub { font-size: 0.7rem; color: var(--brand-muted); }
#view-analytics .f-bar-wrap { flex: 2; }
#view-analytics .f-bar-track { height: 6px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; }
#view-analytics .f-bar-fill { height: 100%; border-radius: 99px; }
#view-analytics .f-count { font-size: 1.2rem; font-weight: 700; min-width: 40px; text-align: right; }
#view-analytics .f-rate { font-size: 0.72rem; color: var(--brand-muted); min-width: 34px; text-align: right; }

/* STAT TRIO */
#view-analytics .stat-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; border-top: var(--card-border); margin-top: 14px; }
#view-analytics .stat-item { text-align: center; padding: 12px 8px 9px; border-right: var(--card-border); }
#view-analytics .stat-item:last-child { border-right: none; }
#view-analytics .stat-lbl { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-muted); font-weight: 700; margin-bottom: 3px; }
#view-analytics .stat-val { font-size: 1.05rem; font-weight: 700; }
#view-analytics .stat-sub { font-size: 0.67rem; color: var(--brand-muted); margin-top: 2px; }
#view-analytics .g3 > .card > .card-body { display: flex; flex-direction: column; }
#view-analytics .g3 > .card > .card-body > .stat-trio { margin-top: auto; }

/* LEGEND */
#view-analytics .legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
#view-analytics .leg-item { display: flex; align-items: center; gap: 5px; font-size: 0.71rem; color: var(--brand-muted); }
#view-analytics .leg-line { width: 16px; height: 2px; border-radius: 2px; }

/* ICP ATTRIBUTION */
#view-analytics .icp-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
#view-analytics .icp-title { flex: 1; font-size: 0.77rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#view-analytics .icp-track { flex: 2; height: 8px; background: rgba(90,82,71,0.1); border-radius: 99px; overflow: hidden; min-width: 40px; }
#view-analytics .icp-fill { height: 100%; border-radius: 99px; background: var(--brand-teal); transition: width 0.8s cubic-bezier(0.2,0.7,0.2,1); }
#view-analytics .icp-count { width: 30px; text-align: right; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
#view-analytics .icp-rate { width: 36px; text-align: right; font-size: 0.7rem; color: var(--brand-muted); flex-shrink: 0; }

#view-analytics .ig-stats { display: flex; gap: 20px; margin-left: auto; }
#view-analytics .ig-stat { text-align: center; }
#view-analytics .ig-stat-val { font-weight: 700; font-size: 0.92rem; }
#view-analytics .ig-stat-lbl { font-size: 0.65rem; color: var(--brand-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* FEED CONTROLS */
#view-analytics .feed-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; padding-bottom:14px; border-bottom:var(--card-border); }
#view-analytics .feed-pills { display:flex; gap:5px; flex-wrap:wrap; }
#view-analytics .feed-pill { padding:5px 13px; border-radius:99px; font-size:0.74rem; font-weight:600; cursor:pointer; color:var(--brand-muted); border:var(--card-border); background:transparent; transition:all 0.13s; font-family:inherit; }
#view-analytics .feed-pill.active { background:var(--brand-teal); color:#fff; border-color:var(--brand-teal); }
#view-analytics .feed-sort-bar { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
#view-analytics .feed-sort-label { font-size:0.72rem; color:var(--brand-muted); font-weight:600; margin-right:2px; }
#view-analytics .feed-sort-btn { padding:4px 11px; border-radius:99px; font-size:0.72rem; font-weight:600; cursor:pointer; color:var(--brand-muted); border:var(--card-border); background:transparent; transition:all 0.13s; font-family:inherit; }
#view-analytics .feed-sort-btn.active { background:rgba(10,91,85,0.1); color:var(--brand-teal); border-color:var(--brand-teal); }
#view-analytics .feed-sort-btn.active.asc { background:rgba(99,0,0,0.1); color:var(--brand-red); border-color:var(--brand-red); }

/* REELS GRID */
#view-analytics .reels-grid { display:grid; grid-template-columns:repeat(6,1fr); gap:10px; }
@media(max-width:1200px){ #view-analytics .reels-grid { grid-template-columns:repeat(4,1fr); } }
@media(max-width:900px){ #view-analytics .reels-grid { grid-template-columns:repeat(3,1fr); } }
@media(max-width:680px){ #view-analytics .reels-grid { grid-template-columns:repeat(2,1fr); } }

#view-analytics .reel-card { background:var(--card-bg); border:var(--card-border); border-radius:var(--radius); overflow:hidden; display:flex; flex-direction:column; }
#view-analytics .reel-video-wrap { position:relative; flex-shrink:0; background:#111; aspect-ratio:9/16; overflow:hidden; }
#view-analytics .reel-thumb-link { display:block; width:100%; height:100%; position:relative; text-decoration:none; }
#view-analytics .reel-thumb-img { width:100%; height:100%; object-fit:cover; display:block; }
#view-analytics .reel-play-icon { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); font-size:1.8rem; color:#fff; background:rgba(0,0,0,0.4); width:48px; height:48px; border-radius:50%; display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity 0.2s; pointer-events:none; }
#view-analytics .reel-thumb-link:hover .reel-play-icon { opacity:1; }
#view-analytics .reel-placeholder { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; background:linear-gradient(160deg,rgba(10,91,85,0.12),rgba(99,0,0,0.07)); color:var(--brand-muted); }
#view-analytics .reel-placeholder-icon { font-size:2.2rem; opacity:0.5; }
#view-analytics .reel-metrics { display:flex; border-top:var(--card-border); }
#view-analytics .reel-stat { flex:1; text-align:center; padding:5px 2px 4px; border-right:var(--card-border); }
#view-analytics .reel-stat:last-child { border-right:none; }
#view-analytics .reel-stat-lbl { font-size:0.48rem; text-transform:uppercase; letter-spacing:0.03em; color:var(--brand-muted); font-weight:700; margin-bottom:1px; }
#view-analytics .reel-stat-val { font-size:0.65rem; font-weight:700; }
#view-analytics .reel-stat-val.icp-val { color:var(--brand-teal); }

/* Empty state */
#view-analytics .reels-empty { padding:40px; text-align:center; color:var(--brand-muted); font-size:0.83rem; grid-column:1/-1; }

/* Sync note */
#view-analytics .ig-sync-note { text-align:center; padding:12px; font-size:0.73rem; color:var(--brand-muted); border-top:var(--card-border); margin-top:14px; }
#view-analytics .ig-sync-note a { color:var(--brand-teal); text-decoration:none; font-weight:600; }

/* CHART TOGGLE BAR */
#view-analytics .chart-toggle-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#view-analytics .ctog { padding: 3px 9px; border-radius: 99px; font-size: 0.68rem; font-weight: 600; cursor: pointer; color: var(--brand-muted); border: var(--card-border); background: transparent; transition: all 0.13s; font-family: inherit; }
#view-analytics .ctog.active { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
#view-analytics .ctog.ctog-all { background: rgba(10,91,85,0.07); color: var(--brand-teal); border-color: transparent; margin-left: 4px; }
#view-analytics .ctog.ctog-none { background: rgba(90,82,71,0.07); color: var(--brand-muted); border-color: transparent; }
#view-analytics .ctog.ctog-all:hover { background: rgba(10,91,85,0.15); }
#view-analytics .ctog.ctog-none:hover { background: rgba(90,82,71,0.13); }

/* COMBINED CHART GRID */
#view-analytics .charts-combined-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 4px; }
@media(max-width:1100px){ #view-analytics .charts-combined-grid { grid-template-columns: repeat(2, 1fr); } }
@media(max-width:700px){ #view-analytics .charts-combined-grid { grid-template-columns: 1fr; } }
#view-analytics .chart-card-wrap { display: contents; }
#view-analytics .chart-card-wrap.chart-hidden { display: none; }

/* DATE RANGE BAR */
#view-analytics .an-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
#view-analytics .an-range-bar { display: flex; gap: 4px; flex-wrap: wrap; }
#view-analytics .an-range-btn { padding: 4px 11px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; cursor: pointer; color: var(--brand-muted); border: var(--card-border); background: transparent; transition: all 0.13s; font-family: inherit; }
#view-analytics .an-range-btn.active { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }
#view-analytics .an-range-btn:hover:not(.active) { border-color: var(--brand-teal); color: var(--brand-teal); }

/* ── ANALYTICS SETUP PAGE ── */
.an-edit-topbar-btn { margin-left: auto !important; order: 999 !important; }
.an-edit-topbar-btn.hidden { display: none !important; }

#an-setup-page { padding-top:4px; }

.an-setup-header { display:flex; align-items:center; gap:16px; margin-bottom:20px; }
.an-back-btn { display:inline-flex; align-items:center; gap:5px; padding:6px 12px; border-radius:8px; border:var(--card-border); background:transparent; font-size:0.78rem; font-weight:600; font-family:inherit; color:var(--brand-muted); cursor:pointer; transition:all 0.13s; }
.an-back-btn:hover { border-color:var(--brand-teal); color:var(--brand-teal); }
.an-setup-title { font-size:1.1rem; font-weight:700; }

.an-setup-tabs { display:flex; gap:6px; border-bottom:none; margin-bottom:24px; }
.an-stab { padding:7px 18px; font-size:0.78rem; font-weight:600; font-family:inherit; background:transparent; border:1px solid var(--brand-border); border-radius:99px; cursor:pointer; color:var(--brand-muted); transition:all 0.2s ease; white-space:nowrap; }
.an-stab.active { background:var(--brand-teal); color:#fff; border-color:var(--brand-teal); }
.an-stab:hover:not(.active) { border-color:var(--brand-teal); color:var(--brand-teal); }

.an-stab-panel { display:none; }
.an-stab-panel.active { display:block; }

.an-setup-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:16px; flex-wrap:wrap; }
.an-setup-section-title { font-size:0.88rem; font-weight:700; margin-bottom:3px; }
.an-setup-section-sub { font-size:0.73rem; color:var(--brand-muted); }
.an-setup-actions-row { display:flex; gap:8px; align-items:center; flex-shrink:0; }

/* Weekly table */
.an-table-scroll { overflow-x:auto; border-radius:var(--radius); border:var(--card-border); background:var(--card-bg); box-shadow:var(--shadow); margin-bottom:10px; }
.an-weekly-table { width:100%; border-collapse:collapse; font-size:0.78rem; }
.an-weekly-table.is-compact { font-size:0.72rem; }
.an-weekly-table.is-compact th { padding:6px 8px; }
.an-weekly-table.is-compact .an-cell-input,
.an-weekly-table.is-compact td { line-height:1.15; }
.an-weekly-table.is-compact td input,
.an-weekly-table.is-compact td .an-cell-input { padding:4px 6px !important; min-height:26px !important; }
.an-weekly-table th { padding:10px 10px; font-size:0.64rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; color:var(--brand-muted); background:rgba(90,82,71,0.04); border-bottom:1px solid var(--brand-border); text-align:center; white-space:nowrap; position:relative; overflow:hidden; user-select:none; }
.an-weekly-table th.an-th-week { text-align:left; }
.an-weekly-table th.an-th-del, .an-weekly-table th.an-th-calc { text-align:center; }
.an-weekly-table td { border-bottom:1px solid var(--brand-border); padding:0; position:relative; text-align:center; }
.an-weekly-table tbody tr:last-child td { border-bottom:none; }
.an-weekly-table tbody tr:hover td { background:rgba(10,91,85,0.03); }
/* Column label tooltip on hover */
.an-weekly-table td[data-label]:hover::after { content:attr(data-label); position:absolute; top:-26px; left:50%; transform:translateX(-50%); background:var(--brand-ink); color:#fff; font-size:0.6rem; font-weight:700; letter-spacing:0.05em; text-transform:uppercase; padding:3px 8px; border-radius:4px; white-space:nowrap; z-index:200; pointer-events:none; }
.an-weekly-table input, .an-weekly-table input[type="number"] { width:100%; padding:8px 10px; border:none !important; border-radius:0; background:transparent; font-family:inherit; font-size:0.79rem; color:var(--brand-ink); outline:none; text-align:center; box-shadow:none !important; -moz-appearance:textfield; }
.an-weekly-table input:focus, .an-weekly-table input[type="number"]:focus { background:rgba(10,91,85,0.06); border:none !important; box-shadow:none !important; }
.an-weekly-table input[type="number"]::-webkit-inner-spin-button,
.an-weekly-table input[type="number"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.an-th-calc { color:var(--brand-teal) !important; }
.an-td-calc { padding:8px 10px; font-size:0.79rem; color:var(--brand-muted); text-align:center; white-space:nowrap; }
/* Ads-active column */
.an-th-ads { width:36px; min-width:36px; max-width:36px; text-align:center !important; }
.an-td-ads { width:36px; min-width:36px; max-width:36px; text-align:center; padding:0 !important; }
.an-ads-chk { appearance:none; -webkit-appearance:none; width:15px; height:15px; border:1.5px solid var(--brand-border); border-radius:2px; cursor:pointer; display:block; margin:0 auto; position:relative; transition:none !important; }
.an-ads-chk:checked { background:var(--brand-teal); border-color:var(--brand-teal); }
.an-ads-chk:checked::after { content:'✓'; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); color:#fff; font-size:11px; line-height:1; font-weight:900; }
.an-ads-chk:hover { border-color:var(--brand-teal); }
:root[data-theme='dark'] .an-ads-chk:checked { background:var(--brand-ink); border-color:var(--brand-ink); }
:root[data-theme='dark'] .an-ads-chk:checked::after { color:var(--brand-cream); }
:root[data-theme='dark'] .an-ads-chk:hover { border-color:var(--brand-ink); }
/* Ads running badge in chart tooltip */
.an-tt-ads { display:inline-flex; align-items:center; gap:4px; background:var(--brand-teal); color:#fff; font-size:0.66rem; font-weight:700; letter-spacing:0.04em; padding:2px 7px; border-radius:20px; margin-bottom:6px; }
.an-tt-ads::before { content:''; display:inline-block; width:5px; height:5px; background:#fff; border-radius:50%; opacity:0.8; }
:root[data-theme='dark'] .an-tt-ads { background:var(--brand-ink); color:var(--brand-cream); }
/* Resizable column handle */
.an-col-resize { position:absolute; right:0; top:0; bottom:0; width:5px; cursor:col-resize; z-index:10; }
.an-col-resize:hover, .an-col-resize.is-dragging { background:var(--brand-teal); opacity:0.35; }
.an-th-week { min-width:170px; width:auto; }
.an-td-week input { text-align:left; font-weight:600; }
/* Revenue dollar wrap */
.an-rev-wrap { display:flex; align-items:center; padding-left:8px; }
.an-rev-wrap .an-rev-dollar { font-size:0.75rem; color:var(--brand-muted); flex-shrink:0; margin-right:2px; }
.an-rev-wrap input { padding-left:2px !important; }
.an-th-del { width:32px; min-width:32px; }
.an-td-del { text-align:center; width:32px; }
/* Delete button only visible on row hover */
.an-del-row-btn { background:none; border:none; cursor:pointer; color:var(--brand-muted); padding:6px 8px; border-radius:6px; font-size:0.85rem; line-height:1; opacity:0; transition:opacity 0.15s, color 0.15s; }
.an-weekly-table tbody tr:hover .an-del-row-btn { opacity:1; }
.an-del-row-btn:hover { color:var(--brand-red); background:rgba(99,0,0,0.07); }
/* Tab bar — prevent clip */
.an-setup-tabs { display:flex; gap:6px; border-bottom:none; margin-bottom:24px; overflow:visible; }
.an-stab { padding:7px 18px; font-size:0.78rem; font-weight:600; font-family:inherit; background:transparent; border:1px solid var(--brand-border); border-radius:99px; cursor:pointer; color:var(--brand-muted); transition:all 0.2s ease; white-space:nowrap; }
.an-stab.active { background:var(--brand-teal); color:#fff; border-color:var(--brand-teal); }
.an-stab:hover:not(.active) { border-color:var(--brand-teal); color:var(--brand-teal); }
.an-stab:active { transform:scale(0.95); }
.an-table-hint { font-size:0.68rem; color:var(--brand-muted); padding:4px 2px; }
.an-settings-clean { max-width: 420px; padding: 20px 0; }
.an-settings-clean .an-field { margin-bottom: 16px; }
.an-settings-clean .an-field label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-muted); margin-bottom: 6px; }
.an-settings-clean .an-field input { width: 100%; padding: 10px 14px; border: var(--card-border); border-radius: 10px; background: var(--card-bg); font-family: inherit; font-size: 0.82rem; color: var(--brand-ink); outline: none; transition: border-color 0.13s; }
.an-settings-clean .an-field input:focus { border-color: var(--brand-teal); }
.an-settings-actions { display: flex; gap: 10px; margin-top: 20px; }
.an-add-row-btn { padding:6px 13px; border-radius:8px; border:var(--card-border); background:transparent; font-size:0.75rem; font-weight:600; font-family:inherit; color:var(--brand-muted); cursor:pointer; transition:all 0.13s; }
.an-add-row-btn:hover { border-color:var(--brand-teal); color:var(--brand-teal); }

/* Metrics grid */
.an-metrics-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:20px 32px; }
@media(max-width:900px){ .an-metrics-grid { grid-template-columns:1fr 1fr; } }
@media(max-width:600px){ .an-metrics-grid { grid-template-columns:1fr; } }
.an-metrics-col { display:flex; flex-direction:column; gap:10px; }
.an-metrics-group-title { font-size:0.65rem; font-weight:700; text-transform:uppercase; letter-spacing:0.08em; color:var(--brand-muted); margin-bottom:4px; margin-top:4px; }
.an-field { display:flex; flex-direction:column; gap:4px; }
.an-field label { font-size:0.68rem; font-weight:600; color:var(--brand-muted); }
.an-field input { padding:8px 11px; border-radius:9px; border:1px solid var(--brand-border); background:var(--brand-bg); font-family:inherit; font-size:0.81rem; color:var(--brand-ink); outline:none; transition:border-color 0.12s; }
.an-field input:focus { border-color:var(--brand-teal); }
.an-field input::placeholder { color:var(--brand-muted); opacity:0.5; }

/* Instagram setup */
.an-ig-setup-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px 40px; }
@media(max-width:700px){ .an-ig-setup-grid { grid-template-columns:1fr; } }
.an-ig-setup-col { display:flex; flex-direction:column; gap:10px; }
.an-ig-key-hint { font-size:0.68rem; color:var(--brand-muted); margin-top:2px; padding:8px 10px; background:rgba(90,82,71,0.05); border-radius:8px; line-height:1.5; }
.an-sync-lg-btn { display:inline-flex; align-items:center; gap:8px; padding:10px 20px; background:var(--brand-teal); color:#fff; border:none; border-radius:10px; font-size:0.82rem; font-weight:700; font-family:inherit; cursor:pointer; transition:opacity 0.13s; }
.an-sync-lg-btn:hover { opacity:0.88; }
.an-ig-status { font-size:0.74rem; color:var(--brand-muted); padding:10px 12px; border-radius:8px; background:rgba(90,82,71,0.06); line-height:1.5; margin-top:4px; }
.an-ig-status.ok { color:var(--brand-teal); background:rgba(10,91,85,0.07); }
.an-ig-status.err { color:var(--brand-red); background:rgba(99,0,0,0.07); }
.an-sync-result { font-size:0.74rem; margin-top:10px; color:var(--brand-muted); }
.an-sync-result.ok { color:var(--brand-teal); }
.an-sync-result.err { color:var(--brand-red); }

/* Shared action buttons */
.an-save-btn { padding:8px 18px; background:var(--brand-teal); color:#fff; border:none; border-radius:9px; font-size:0.79rem; font-weight:700; font-family:inherit; cursor:pointer; transition:opacity 0.13s; }
.an-save-btn:hover { opacity:0.88; }
.an-reset-btn { padding:8px 14px; background:transparent; color:var(--brand-muted); border:1px solid var(--brand-border); border-radius:9px; font-size:0.77rem; font-weight:600; font-family:inherit; cursor:pointer; transition:all 0.13s; }
.an-reset-btn:hover { border-color:var(--brand-muted); color:var(--brand-ink); }

/* ── SETUP KPI STRIP ── */
.an-setup-kpi-strip { display:flex; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.an-setup-kpi { background:var(--card-bg); border:var(--card-border); border-radius:var(--radius); padding:10px 16px; min-width:100px; flex:1; }
.an-setup-kpi-label { font-size:0.58rem; font-weight:700; letter-spacing:0.08em; text-transform:uppercase; color:var(--brand-muted); margin-bottom:3px; }
.an-setup-kpi-val { font-size:1rem; font-weight:700; color:var(--brand-teal); }
.an-search-input { padding:6px 12px; border-radius:8px; border:var(--card-border); background:var(--brand-bg); font-family:inherit; font-size:0.79rem; color:var(--brand-ink); outline:none; width:160px; transition:border-color 0.12s; }
.an-search-input:focus { border-color:var(--brand-teal); }
.an-search-input::placeholder { color:var(--brand-muted); opacity:0.55; }

/* Wider week column for date range button */
.an-th-week { min-width:170px; }
.an-td-week { min-width:170px; }
/* ── 3-column grid for ICP section ── */
.an-g3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; align-items:stretch; }
.an-g3 > .card { display:flex; flex-direction:column; }
.an-g3 > .card > .card-body { display:flex; flex-direction:column; flex:1; }
.an-g3 > .card > .card-body > .an-stat-trio { margin-top:auto; }
@media (max-width:900px) { .an-g3 { grid-template-columns:1fr; } }
/* ── Reel thumbnail ── */
.an-reel-thumb-link { display:block; position:relative; width:100%; aspect-ratio:9/16; overflow:hidden; border-radius:8px; background:#111; text-decoration:none; }
.an-reel-thumb-img { width:100%; height:100%; object-fit:cover; display:block; }
.an-reel-play-icon { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:1.4rem; color:#fff; opacity:0; transition:opacity 0.15s; background:rgba(0,0,0,0.3); }
.an-reel-thumb-link:hover .an-reel-play-icon { opacity:1; }

/* ── ANALYTICS UX POLISH ─────────────────────────────────────────────────── */

/* KPI cards: smooth hover lift */
.an-kpi { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.an-kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(10,91,85,0.10); border-color: var(--brand-teal); }

/* KPI values: smooth number transitions */
.an-kpi-val { transition: color 0.2s ease; }

/* Chart cards: smooth hover */
.an-chart-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.an-chart-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(10,91,85,0.08); }

/* Range bar buttons: smoother transitions */
#view-analytics .an-range-btn { transition: all 0.2s ease; }
#view-analytics .an-range-btn:active { transform: scale(0.95); }

/* Sort buttons: smoother transitions */
.an-sort-btn { transition: all 0.2s ease, transform 0.1s ease; }
.an-sort-btn:active { transform: scale(0.95); }

/* Chart toggle buttons: smoother */
#view-analytics .an-ctog { transition: all 0.18s ease; }
#view-analytics .an-ctog:hover:not(.an-ctog-active) { border-color: var(--brand-teal); color: var(--brand-teal); }
#view-analytics .an-ctog:active { transform: scale(0.95); }

/* ICP bars: smooth fill + hover */
#view-analytics .icp-row { transition: background 0.15s ease; border-radius: 6px; padding: 2px 4px; margin-left: -4px; margin-right: -4px; }
#view-analytics .icp-row:hover { background: rgba(10,91,85,0.03); }

/* Reel cards: smooth hover */
.an-reel-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.an-reel-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }

/* Feed sort bar: smooth */
#view-analytics .feed-sort-btn { transition: all 0.2s ease; }
#view-analytics .feed-sort-btn:active { transform: scale(0.95); }

/* Chart SVG wrapper: smooth content swap */
.an-svg-wrap { transition: opacity 0.15s ease; }

/* Tooltip: smooth show */
.an-tooltip { transition: opacity 0.15s ease, transform 0.15s ease; transform: translateY(4px); }
.an-tooltip.show { transform: translateY(0); }

/* Bar fill animations: smoother */
.an-bar-fill { transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94); }
#view-analytics .bar-fill { transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94); }

/* Section labels: subtle fade in */
.an-section-label { transition: color 0.2s ease; }

/* Edit Data button: polish */
.an-edit-topbar-btn { transition: all 0.2s ease; }
.an-edit-topbar-btn:hover { border-color: var(--brand-teal); color: var(--brand-teal); }

/* Setup page back button: smoother */
.an-back-btn { transition: all 0.2s ease, transform 0.1s ease; }
.an-back-btn:active { transform: scale(0.97); }

/* Setup table inputs: polish */
.an-setup-input { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.an-setup-input:focus { box-shadow: 0 0 0 2px rgba(10,91,85,0.12); }

/* Instagram stats: smooth */
#view-analytics .ig-stat-val { transition: color 0.2s ease; }

/* Overall smooth scroll within analytics */
#view-analytics { scroll-behavior: smooth; }

/* Revenue tracking date input */
.an-wi-date { min-width: 120px; font-size: 0.76rem !important; }
.an-rev-wrap { display: flex; align-items: center; gap: 0; }
.an-rev-dollar { font-size: 0.76rem; font-weight: 600; color: var(--brand-muted); margin-right: 2px; flex-shrink: 0; }
.an-rev-wrap .an-wi { padding-left: 2px; }

/* ── Phone optimisations for new Analytics view (≤640px only) ──────────────
   Scoped exclusively to #view-analytics / #an-setup-page / #anEditBtn so no
   other breakpoint or view is affected. */
@media (max-width: 640px) {

  /* Restore the Edit Data topbar button on phone (its shared
     .activity-drawer-toggle class is globally hidden on mobile). Higher
     specificity via the id overrides that rule. */
  #anEditBtn.an-edit-topbar-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    height: 32px;
    font-size: 12px;
  }
  #anEditBtn.an-edit-topbar-btn.hidden { display: none !important; }

  /* ── Main content: tighter rhythm ───────────────────────────────────── */
  #view-analytics .slabel { margin-top: 16px; margin-bottom: 8px; }
  #view-analytics #anToggleHeader { margin-top: 10px !important; }

  /* ── KPI row: compact cards, bigger tap area ────────────────────────── */
  #view-analytics .an-kpi-row { gap: 6px; margin: 8px 0 4px; }
  #view-analytics .an-kpi { padding: 10px 12px 9px; }
  #view-analytics .an-kpi-lbl { font-size: 0.58rem; margin-bottom: 4px; }
  #view-analytics .an-kpi-val { font-size: 1.15rem; }
  #view-analytics .an-kpi-delta { font-size: 0.64rem; padding: 1px 7px; margin-top: 4px; }

  /* Remove hover lift on touch devices — prevents sticky :hover states */
  #view-analytics .an-kpi:hover,
  #view-analytics .an-chart-card:hover,
  #view-analytics .an-reel-card:hover {
    transform: none;
    box-shadow: var(--shadow);
  }

  /* ── Charts header row (label + toggles + range) stacks on phone ───── */
  /* Target the .slabel that carries inline display:flex (the charts row) */
  #view-analytics .slabel[style*="display:flex"] {
    flex-wrap: wrap !important;
    row-gap: 8px !important;
    gap: 8px !important;
    align-items: flex-start !important;
  }
  #view-analytics .an-charts-label {
    flex: 1 1 100% !important;
    order: 1;
  }
  #view-analytics .an-chart-toggle-bar {
    flex: 1 1 100% !important;
    order: 2;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #view-analytics .an-chart-toggle-bar::-webkit-scrollbar { display: none; }
  #view-analytics .an-ctog {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 0.72rem;
    min-height: 30px;
  }
  #view-analytics .an-range-bar {
    flex: 1 1 100% !important;
    order: 3;
    margin-left: 0 !important;
    gap: 4px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #view-analytics .an-range-bar::-webkit-scrollbar { display: none; }
  #view-analytics .an-range-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    min-height: 30px;
    font-size: 0.72rem;
  }

  /* ── Charts grid: tighter spacing + typography ──────────────────────── */
  #view-analytics .an-charts-grid { gap: 10px; }
  #view-analytics .an-chart-card { padding: 12px 14px 10px; }
  #view-analytics .an-chart-title { font-size: 0.82rem; }
  #view-analytics .an-chart-sub { font-size: 0.68rem; margin-bottom: 10px; }

  /* Stat trio: prevent cramped values & overflow */
  #view-analytics .an-stat-trio { margin-top: 10px; }
  #view-analytics .an-stat-item { padding: 9px 4px 7px; }
  #view-analytics .an-stat-lbl { font-size: 0.56rem; letter-spacing: 0.04em; }
  #view-analytics .an-stat-val { font-size: 0.9rem; }
  #view-analytics .an-stat-sub { font-size: 0.6rem; }

  /* ── ICP / Pillar / Funnel cards ────────────────────────────────────── */
  #view-analytics .an-g3 { gap: 10px; }
  #view-analytics .card-body { padding: 14px 14px 12px; }
  #view-analytics .card-title { font-size: 0.82rem; }
  #view-analytics .card-sub { font-size: 0.68rem; margin-bottom: 10px; }
  #view-analytics .an-icp-row { gap: 7px; }
  #view-analytics .an-icp-title { font-size: 0.72rem; }
  #view-analytics .an-icp-count { font-size: 0.76rem; width: 28px; }
  #view-analytics .an-icp-rate { font-size: 0.66rem; width: 32px; }

  /* ── Client Instagram feed header: stack sort + stats ──────────────── */
  #view-analytics .an-feed-head {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }
  #view-analytics .an-feed-sort-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  #view-analytics .an-feed-sort-bar::-webkit-scrollbar { display: none; }
  #view-analytics .an-sort-btn {
    flex-shrink: 0;
    min-height: 30px;
    padding: 5px 12px;
  }
  /* Stats row (3 stats): full-width, distribute evenly with subtle backdrop */
  #view-analytics .an-feed-head > div[style*="display:flex"]:not(.an-feed-sort-bar) {
    justify-content: space-around !important;
    gap: 8px !important;
    padding: 8px 4px;
    border: 1px solid var(--brand-border);
    border-radius: 10px;
    background: rgba(90, 82, 71, 0.03);
  }

  /* ── Reels grid: tighter gap, smaller overlay ──────────────────────── */
  #view-analytics .an-reels-grid { gap: 3px; }
  #view-analytics .an-reel-overlay {
    padding: 4px 6px;
    font-size: 0.6rem;
    gap: 6px;
  }

  /* ── Setup (data-entry) page on phone ──────────────────────────────── */
  #an-setup-page .an-setup-header {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  #an-setup-page .an-back-btn { padding: 6px 10px; font-size: 0.75rem; }
  #an-setup-page .an-setup-title { font-size: 0.98rem; flex: 1 1 auto; }
  #an-setup-page .an-setup-section-sub { font-size: 0.68rem; flex: 1 1 100%; margin-top: 0 !important; }
  /* The search + add-row cluster has an inline margin-left:auto — unpin on phone */
  #an-setup-page .an-setup-header > div[style*="margin-left:auto"] {
    margin-left: 0 !important;
    width: 100%;
    display: flex;
    gap: 8px;
  }
  #an-setup-page .an-search-input { flex: 1; width: auto; min-width: 0; }
  #an-setup-page .an-add-row-btn { flex-shrink: 0; }

  /* Setup tabs: horizontal scroll instead of wrapping */
  #an-setup-page .an-setup-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
  }
  #an-setup-page .an-setup-tabs::-webkit-scrollbar { display: none; }
  #an-setup-page .an-stab {
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 0.74rem;
  }

  /* Setup KPI strip: evenly distribute */
  #an-setup-page .an-setup-kpi-strip { gap: 6px; }
  #an-setup-page .an-setup-kpi { min-width: 0; padding: 8px 10px; flex: 1 1 45%; }
  #an-setup-page .an-setup-kpi-val { font-size: 0.9rem; }

  /* ── Toolbar arrangement on Analytics view ─────────────────────────────
     Detect Analytics via #anEditBtn being un-hidden (a JS-driven signal),
     then consolidate the .view-tabs-row into a single clean row:
        [Views & Tools] ····································· [Edit Data]
     The search / sort / filter / add-video controls are irrelevant on
     Analytics, so we hide them. They remain available in the other views. */
  .view-tabs-row:has(#anEditBtn:not(.hidden)) #workspaceSearchBar,
  .view-tabs-row:has(#anEditBtn:not(.hidden)) #newVideoTabsSlot,
  .view-tabs-row:has(#anEditBtn:not(.hidden)) #gridSortButton,
  .view-tabs-row:has(#anEditBtn:not(.hidden)) #boardMonthFilterButton,
  .view-tabs-row:has(#anEditBtn:not(.hidden)) #newVideoButton {
    display: none !important;
  }
  .view-tabs-row:has(#anEditBtn:not(.hidden)) {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  /* "Views & Tools" sits flush-left; Edit Data keeps its existing
     margin-left:auto + order:999 which now pushes it to the far right. */
  .view-tabs-row:has(#anEditBtn:not(.hidden)) .mobile-tools-toggle {
    margin-left: 0 !important;
  }

  /* ── Scripts view on phone ─────────────────────────────────────────────
     Issues addressed:
       • Tab list had overflow:hidden (for the collapse animation), which
         also prevented vertical scrolling when there were many scripts.
       • Sidebar was capped at 220px (inherited from ≤760px), leaving the
         list squished; we need more room on phone.
       • Tabs rendered too close together; add breathing room. */
  #view-scripts .scripts-sidebar {
    max-height: 50vh;
  }
  #view-scripts .scripts-sidebar-head {
    min-height: 40px;
  }
  /* Expanded state: allow the tab list to scroll vertically */
  #view-scripts .scripts-sidebar .scripts-tabs {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-right: 4px;
  }
  /* Only clip during the collapse transition — when is-collapsed, max-height
     goes to 0 and pointer-events is already none, so hiding overflow is safe. */
  #view-scripts .scripts-sidebar.is-collapsed .scripts-tabs {
    overflow: hidden;
  }
  /* Larger touch targets + clear separation between rows */
  #view-scripts .scripts-tab {
    padding: 10px 11px;
    min-height: 40px;
  }
  #view-scripts .scripts-group {
    gap: 6px;
  }
}
