.campaign-spends-table-view:fullscreen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.campaign-spends-table-view:fullscreen > div:first-child {
  display: flex;
  flex: 1;
  min-height: 0;
  margin-top: 0;
  padding: 0;
}

.campaign-spends-table-view:fullscreen #campaign-spends-table,
.campaign-spends-table-view:fullscreen #campaign-spends-table > [data-controller],
.campaign-spends-table-view:fullscreen #campaign-spends-table > [data-controller] > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.campaign-spends-table-view:fullscreen #campaign-spends-table > [data-controller] > div {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.campaign-spends-table-view:fullscreen .small-scrollbar {
  flex: 1;
  min-height: 0;
  max-height: none !important;
}
/* ==========================================================================
   Mozilla Proton-Inspired Markdown Styles
   Professional, clean, and accessible design
   ========================================================================== */

/* ==========================================================================
   Base Typography & Layout
   ========================================================================== */

/* Scoped markdown rendering styles for playbook item display + preview */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) {
  /* Proton color tokens */
  --md-text-primary: #1a1a1a;
  --md-text-secondary: #52525e;
  --md-text-tertiary: #8f8f8f;
  --md-link-color: #0060df;
  --md-link-hover: #003eaa;
  --md-border-color: #e0e0e6;
  --md-bg-subtle: #f0f0f4;
  --md-bg-canvas: #ffffff;
  --md-accent-primary: #0060df;
  --md-accent-secondary: #9059ff;
  --md-success: #2ac35d;
  --md-warning: #ffa436;
  --md-error: #d7264c;

  /* Spacing scale (8px base) */
  --md-space-1: 0.5rem;   /* 8px */
  --md-space-2: 1rem;     /* 16px */
  --md-space-3: 1.5rem;   /* 24px */
  --md-space-4: 2rem;     /* 32px */
  --md-space-5: 2.5rem;   /* 40px */

  /* Typography */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--md-text-primary);
  max-width: none;
}

/* Dark mode overrides */
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) {
  --md-text-primary: #f9f9fb;
  --md-text-secondary: #a7a7b5;
  --md-text-tertiary: #6e6e7a;
  --md-link-color: #73a7fe;
  --md-link-hover: #2b7eff;
  --md-border-color: #3a3a44;
  --md-bg-subtle: #2b2a33;
  --md-bg-canvas: #1c1b22;
  --md-accent-primary: #73a7fe;
}

/* ==========================================================================
   Headings
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(h1, h2, h3, h4, h5, h6) {
  font-weight: 600;
  line-height: 1.25;
  color: var(--md-text-primary);
  margin-top: var(--md-space-4);
  margin-bottom: var(--md-space-2);
  letter-spacing: -0.01em;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: var(--md-space-3);
  padding-bottom: var(--md-space-2);
  border-bottom: 2px solid var(--md-border-color);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h2 {
  font-size: 1.5rem;
  margin-top: var(--md-space-4);
  padding-bottom: var(--md-space-1);
  border-bottom: 1px solid var(--md-border-color);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h3 {
  font-size: 1.25rem;
  margin-top: var(--md-space-3);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h4 {
  font-size: 1.125rem;
  color: var(--md-text-secondary);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h5 {
  font-size: 1rem;
  color: var(--md-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) h6 {
  font-size: 0.875rem;
  color: var(--md-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Heading anchor links */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(h1, h2, h3, h4, h5, h6) a[id] {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   Paragraphs & Text
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) p {
  margin-bottom: var(--md-space-2);
  color: var(--md-text-primary);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(strong, b) {
  font-weight: 600;
  color: var(--md-text-primary);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(em, i) {
  font-style: italic;
  color: var(--md-text-secondary);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) del,
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) s,
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) strike {
  text-decoration: line-through;
  color: var(--md-text-tertiary);
  opacity: 0.7;
}

/* Horizontal rule */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) hr {
  height: 2px;
  margin: var(--md-space-4) 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--md-border-color) 20%,
    var(--md-border-color) 80%,
    transparent 100%
  );
  border: none;
}

/* ==========================================================================
   Links
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) a {
  color: var(--md-link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) a:hover {
  color: var(--md-link-hover);
  text-decoration-thickness: 2px;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) a:focus-visible {
  outline: 2px solid var(--md-accent-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ==========================================================================
   Lists
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(ul, ol) {
  margin-bottom: var(--md-space-2);
  padding-left: var(--md-space-3);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) ul {
  list-style-type: disc;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) ol {
  list-style-type: decimal;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) :is(ul, ol) :is(ul, ol) {
  margin-top: var(--md-space-1);
  margin-bottom: var(--md-space-1);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) ul ul {
  list-style-type: circle;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) ul ul ul {
  list-style-type: square;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) li {
  margin-bottom: var(--md-space-1);
  padding-left: var(--md-space-1);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) li::marker {
  color: var(--md-text-tertiary);
}

/* ==========================================================================
   Code & Preformatted Text
   ========================================================================== */

/* Inline code */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) code:not(pre code) {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
  background-color: var(--md-bg-subtle);
  color: var(--md-text-primary);
  padding: 0.125em 0.375em;
  border-radius: 4px;
  border: 1px solid var(--md-border-color);
  word-break: break-word;
}

/* Remove Tailwind typography backticks */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) code::before,
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) code::after {
  content: none !important;
}

/* Code blocks */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  background: var(--md-bg-canvas);
  border: 1px solid var(--md-border-color);
  border-radius: 8px;
  overflow-x: auto;
  padding: 0;
  margin: var(--md-space-2) 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) pre code {
  display: block;
  padding: var(--md-space-2);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--md-text-primary);
  background: transparent;
  border: none;
  border-radius: 0;
  white-space: pre;
  overflow-x: auto;
}

/* Syntax highlighting container */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight {
  background: var(--md-bg-canvas);
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--md-border-color);
  margin: var(--md-space-2) 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight pre {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight code {
  display: block;
  padding: var(--md-space-2);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--md-text-primary);
  background: transparent;
}

/* ==========================================================================
   Syntax Highlighting Colors (GitHub-inspired with Proton adjustments)
   ========================================================================== */

/* Light mode syntax colors */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.c, .cm, .c1, .cs) {
  color: #6e7781;
  font-style: italic;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.k, .kc, .kd, .kn, .kp, .kr, .kt) {
  color: #d91e18;
  font-weight: 600;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.s, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1) {
  color: #0a3069;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .na { color: #116329; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nb { color: #953800; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nc { color: #953800; font-weight: 600; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .no { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nd { color: #8250df; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .ni { color: var(--md-text-primary); }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .ne { color: #953800; font-weight: 600; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nf { color: #8250df; font-weight: 600; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nl { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nn { color: #953800; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nt { color: #116329; font-weight: 600; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nv { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.o, .ow) { color: #cf222e; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.m, .mf, .mh, .mi, .mo, .il) { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .p { color: var(--md-text-primary); }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .bp { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .fm { color: #8250df; font-weight: 600; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.vc, .vg, .vi, .vm) { color: #0550ae; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .err { color: #cf222e; font-weight: 600; }

/* Dark mode syntax colors */
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.c, .cm, .c1, .cs) {
  color: #8b949e;
  font-style: italic;
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.k, .kc, .kd, .kn, .kp, .kr, .kt) {
  color: #ff7b72;
  font-weight: 600;
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.s, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1) {
  color: #a5d6ff;
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .na { color: #7ee787; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nb { color: #ffa657; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nc { color: #ffa657; font-weight: 600; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .no { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nd { color: #d2a8ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .ni { color: var(--md-text-primary); }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .ne { color: #ffa657; font-weight: 600; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nf { color: #d2a8ff; font-weight: 600; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nl { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nn { color: #ffa657; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nt { color: #7ee787; font-weight: 600; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .nv { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.o, .ow) { color: #ff7b72; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.m, .mf, .mh, .mi, .mo, .il) { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .p { color: var(--md-text-primary); }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .bp { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .fm { color: #d2a8ff; font-weight: 600; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight :is(.vc, .vg, .vi, .vm) { color: #79c0ff; }
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight .err { color: #f85149; font-weight: 600; }

/* ==========================================================================
   Blockquotes
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) blockquote {
  margin: var(--md-space-2) 0;
  padding: var(--md-space-2) var(--md-space-3);
  background: linear-gradient(
    90deg,
    var(--md-accent-primary) 0%,
    var(--md-accent-primary) 4px,
    var(--md-bg-subtle) 4px,
    var(--md-bg-subtle) 100%
  );
  border-radius: 0 8px 8px 0;
  color: var(--md-text-secondary);
  font-style: italic;
  border: 1px solid var(--md-border-color);
  border-left: none;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) blockquote p:last-child {
  margin-bottom: 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) blockquote :is(h1, h2, h3, h4, h5, h6) {
  margin-top: 0;
  color: var(--md-text-primary);
  font-style: normal;
}

/* Nested blockquotes */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) blockquote blockquote {
  margin: var(--md-space-1) 0;
  background: var(--md-bg-canvas);
}

/* ==========================================================================
   Playbook Item Table of Contents
   ========================================================================== */

.playbook-item-toc-shell,
.playbook-item-toc-card {
  max-height: calc(100vh - 8rem);
}

.playbook-item-toc-card,
.playbook-item-toc-nav {
  display: flex;
  flex-direction: column;
}

.playbook-item-toc-nav {
  flex: 1 1 auto;
  min-height: 0;
}

.playbook-item-toc-list {
  min-height: 0;
  overflow-y: auto;
}

/* ==========================================================================
   Tables
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .markdown-table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--md-space-2) 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--md-border-color);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) table {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) thead {
  background: var(--md-bg-subtle);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) th {
  font-weight: 600;
  text-align: left;
  padding: var(--md-space-1) var(--md-space-2);
  border-bottom: 2px solid var(--md-border-color);
  color: var(--md-text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) td {
  padding: var(--md-space-1) var(--md-space-2);
  border-bottom: 1px solid var(--md-border-color);
  vertical-align: top;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) tbody tr:last-child td {
  border-bottom: none;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) tbody tr:hover {
  background: var(--md-bg-subtle);
}

/* Zebra striping for better readability */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Task Lists
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .task-list-item {
  list-style-type: none;
  margin-left: -1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .task-list-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.375rem;
  border: 2px solid var(--md-border-color);
  border-radius: 4px;
  background-color: var(--md-bg-canvas);
  cursor: not-allowed;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .task-list-item input[type="checkbox"]:checked {
  background-color: var(--md-accent-primary);
  border-color: var(--md-accent-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z'/%3E%3C/svg%3E");
  background-size: 85%;
  background-position: center;
  background-repeat: no-repeat;
}

/* Dark mode task list */
.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .task-list-item input[type="checkbox"]:checked {
  background-color: var(--md-accent-primary);
  border-color: var(--md-accent-primary);
}

/* ==========================================================================
   Images & Media
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) img {
  max-width: 100%;
  height: auto;
  margin: var(--md-space-2) 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) figure {
  margin: var(--md-space-3) 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--md-text-tertiary);
  margin-top: var(--md-space-1);
}

/* ==========================================================================
   Mermaid Diagrams
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .mermaid {
  background: var(--md-bg-canvas);
  border-radius: 8px;
  overflow-x: auto;
  padding: var(--md-space-3);
  border: 1px solid var(--md-border-color);
  display: flex;
  justify-content: center;
  margin: var(--md-space-2) 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .mermaid svg {
  max-width: 100%;
  height: auto;
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .mermaid {
  background: var(--md-bg-canvas);
  border-color: var(--md-border-color);
}

/* ==========================================================================
   Definition Lists (if supported)
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) dl {
  margin: var(--md-space-2) 0;
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) dt {
  font-weight: 600;
  color: var(--md-text-primary);
  margin-top: var(--md-space-2);
}

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) dd {
  margin-left: var(--md-space-3);
  color: var(--md-text-secondary);
  margin-bottom: var(--md-space-1);
}

/* ==========================================================================
   Keyboard Input
   ========================================================================== */

:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) kbd {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8em;
  background: linear-gradient(180deg, #fff 0%, var(--md-bg-subtle) 100%);
  border: 1px solid var(--md-border-color);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.125em 0.5em;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  color: var(--md-text-primary);
}

.dark :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) kbd {
  background: linear-gradient(180deg, var(--md-bg-canvas) 0%, var(--md-bg-subtle) 100%);
  border-color: var(--md-border-color);
}

/* ==========================================================================
   Markdown Editor Specific Styles
   ========================================================================== */

.markdown-editor .editor-pane textarea {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--md-text-primary);
  background: var(--md-bg-canvas);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Text alignment helpers */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .text-center { text-align: center; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .text-right { text-align: right; }
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .text-left { text-align: left; }

/* Lead paragraph styling */
:where(.playbook-item-markdown, .markdown-editor, .chat-markdown) > p:first-of-type {
  font-size: 1.125rem;
  color: var(--md-text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) {
    --md-text-primary: #000;
    --md-text-secondary: #333;
    --md-border-color: #ccc;
    --md-bg-subtle: #f5f5f5;
    --md-bg-canvas: #fff;
    --md-link-color: #000;
  }

  :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) a {
    text-decoration: underline;
  }

  :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) pre,
  :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .highlight,
  :where(.playbook-item-markdown, .markdown-editor, .chat-markdown) .mermaid {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
}

/* Force Markdown Table Horizontal Scroll overriding Tailwind prose */
.playbook-item-markdown .markdown-table-wrapper {
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.playbook-item-markdown .markdown-table-wrapper table {
  display: table !important;
  width: max-content !important;
  min-width: 100% !important;
}

/* Keep conversation typography compact without changing document styles. */
.chat-markdown { font-size: 0.875rem; overflow-wrap: anywhere; }
.chat-markdown > p:first-of-type { font-size: inherit; color: inherit; line-height: inherit; }
.chat-markdown > :first-child { margin-top: 0; }
.chat-markdown > :last-child { margin-bottom: 0; }
.chat-markdown :is(h1, h2) { font-size: 1.25rem; border: 0; padding-bottom: 0; }
.chat-markdown pre { white-space: pre; overflow-x: auto; }
.pagy {
  --spacing: 0.15rem;
  --padding: 0.7rem;
  --rounding: 0.5rem;
  --border-width: 1px;
  --font-size: 0.875rem;
  --font-weight: 500;
  --line-height: 1.6;

  /* teal theme (tailwind teal) */
  --text: #134e4a; /* teal-900 */
  --text-hover: #0f766e; /* teal-700 */
  --text-current: #ffffff; /* on-teal text */
  --background: #f0fdfa; /* teal-50 */
  --background-hover: #ccfbf1; /* teal-100 */
  --background-current: #00B5AD; /* teal brand color */
  --background-input: #ffffff;

  color: var(--text);
  font-size: var(--font-size);
  line-height: var(--line-height);
  font-weight: var(--font-weight);
  display: flex;
  user-select: none;
}

.pagy > :not([hidden]) ~ :not([hidden]) {
  margin-left: calc(var(--spacing) * (1 - var(--space-reverse, 0)));
  margin-right: calc(var(--spacing) * var(--space-reverse, 0));
}

.rtl .pagy > :not([hidden]) ~ :not([hidden]) {
  --space-reverse: 1;
}

.pagy a:not([role="separator"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  text-decoration: none;
  background-color: var(--background);
  padding: 0.25rem;
  border: var(--border-width) solid #ccfbf1; /* replaced neutral border with light teal */
  border-radius: var(--rounding);
  color: inherit;
}

.pagy a[href]:hover {
  background-color: var(--background-hover);
  color: var(--text-hover);
}

.pagy a:not([href]) {
  cursor: default;
}

.pagy a[role="link"]:not([aria-current]) {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagy a[aria-current],
.pagy span[aria-current] {
  background-color: var(--background-current);
  color: var(--text-current);
  border-color: var(--background-current);
}

.pagy a[aria-label="Previous"],
.pagy a[aria-label="Next"] {
  position: relative;
  font-size: 0;
  color: var(--text);
}

.pagy a[aria-label="Previous"]::before,
.pagy a[aria-label="Next"]::before {
  content: "";
  display: block;
  width: 1rem;
  height: 1rem;
  margin: auto;
  background-size: 0.75rem 0.75rem;
  background-repeat: no-repeat;
  background-position: center;
}

.pagy a[aria-label="Previous"]::before {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' stroke='currentColor'%3E%3Cpolyline points='7.75 1.75 3.5 6 7.75 10.25'%3E%3C/polyline%3E%3C/g%3E%3C/svg%3E");
}

.pagy a[aria-label="Next"]::before {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' stroke='currentColor'%3E%3Cpolyline points='4.25 10.25 8.5 6 4.25 1.75'%3E%3C/polyline%3E%3C/g%3E%3C/svg%3E");
}

.pagy [role="separator"] {
  background: transparent;
  color: #5eead4; /* teal-300 */
  padding: 0.25rem 0.4rem;
  border: none;
  box-shadow: none;
}

.pagy label {
  white-space: nowrap;
  display: inline-block;
  border: var(--border-width) solid #ccfbf1;
  border-radius: var(--rounding);
  background-color: var(--background);
  padding: 0.2rem 0.5rem;
}

.pagy label input {
  all: unset;
  border: 1px solid #ccfbf1;
  border-radius: calc(var(--rounding) / 2) !important;
  background-color: var(--background-input);
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
}

.pagy-compact .pagy {
  --spacing: 0.1rem;
  --padding: 0.55rem;
  --rounding: 0.35rem;
}

.dark .pagy {
  /* dark teal adjustments */
  --text: #f5f5f5; /* keep light text */
  --text-hover: #ffffff;
  --text-current: #071e1b; /* very dark teal-ish text on light current bg */
  --background: #0b2f2b; /* dark-teal background */
  --background-hover: #134e4a; /* slightly lighter dark teal */
  --background-current: #2dd4bf; /* teal-400 as current (light) */
  --background-input: #0b2f2b; /* dark teal for inputs */
}

.dark .pagy a:not([role="separator"]) {
  border-color: #ffffff1a; /* white/10 */
  background-color: var(--background);
}

.dark .pagy a:not([role="separator"]):hover {
  border-color: #ffffff1a; /* white/10 */
  background-color: var(--background-hover);
  color: var(--text-hover);
}

.dark .pagy a[aria-current]:hover {
  background-color: var(--background-current);
  color: var(--text-current);
}

.dark .pagy a[aria-current] {
  border-color: var(--background-current);
  background-color: var(--background-current);
}

.dark .pagy a[aria-label="Previous"]::before {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.2' stroke='%23f5f5f5'%3E%3Cpolyline points='7.75 1.75 3.5 6 7.75 10.25'%3E%3C/polyline%3E%3C/g%3E%3C/svg%3E");
}

.dark .pagy a[aria-label="Next"]::before {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cg fill='none' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.2' stroke='%23f5f5f5'%3E%3Cpolyline points='4.25 10.25 8.5 6 4.25 1.75'%3E%3C/polyline%3E%3C/g%3E%3C/svg%3E");
}

.dark .pagy [role="separator"] {
  color: #5eead4; /* teal-300 */
}

.dark .pagy label {
  border-color: #262626;
  background-color: var(--background);
}

.dark .pagy label input {
  border-color: #262626;
  background-color: var(--background-input);
  color: var(--text);
}

/* Loading state for Turbo Frame pagination */
turbo-frame[aria-busy="true"] .pagy {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

/* Loading indicator with overlay */
turbo-frame[aria-busy="true"][data-pagy-loading-indicator] {
  position: relative;
  cursor: wait;
  pointer-events: none;
}

/* Semi-transparent overlay */
turbo-frame[aria-busy="true"][data-pagy-loading-indicator]::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(2px);
  z-index: 10;
  opacity: 0;
  animation: pagy-fade-in 0.15s ease forwards;
}

.dark turbo-frame[aria-busy="true"][data-pagy-loading-indicator]::before {
  background-color: rgba(23, 23, 23, 0.75);
}

/* Spinning loader */
turbo-frame[aria-busy="true"][data-pagy-loading-indicator]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2.5px solid #e5e5e5;
  border-top-color: #171717;
  border-radius: 50%;
  opacity: 0;
  animation: pagy-spin 0.6s linear infinite, pagy-fade-in 0.15s ease forwards;
  z-index: 11;
  pointer-events: none;
}

.dark turbo-frame[aria-busy="true"][data-pagy-loading-indicator]::after {
  border-color: #404040;
  border-top-color: #f5f5f5;
}

@keyframes pagy-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

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

/* Mobile responsive styles */
@media (max-width: 640px) {
  .pagy {
    --spacing: 0.1rem;
    --padding: 0.3rem;
    --font-size: 0.75rem;
  }

  .pagy a:not([role="separator"]) {
    min-width: 1.75rem;
    min-height: 1.75rem;
    padding: 0.1rem;
  }

  .pagy a[role="separator"] {
    padding: 0.15rem 0.2rem;
    font-size: 0.75rem;
  }

  .pagy label {
    padding: 0.1rem 0.3rem;
  }

  .pagy label input {
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
