/* ==========================================================================
   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) {
  /* 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) {
  --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) :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) 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) 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) h3 {
  font-size: 1.25rem;
  margin-top: var(--md-space-3);
}

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

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

:where(.playbook-item-markdown, .markdown-editor) 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) :is(h1, h2, h3, h4, h5, h6) a[id] {
  text-decoration: none;
  color: inherit;
}

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

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

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

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

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

/* Horizontal rule */
:where(.playbook-item-markdown, .markdown-editor) 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) 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;
}

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

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

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

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

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

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

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

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

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

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

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

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

/* Inline code */
:where(.playbook-item-markdown, .markdown-editor) 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;
}

/* Code blocks */
:where(.playbook-item-markdown, .markdown-editor) 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) 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) .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) .highlight pre {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

:where(.playbook-item-markdown, .markdown-editor) .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) .highlight :is(.c, .cm, .c1, .cs) { 
  color: #6e7781; 
  font-style: italic; 
}

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

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

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

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

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

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

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

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

:where(.playbook-item-markdown, .markdown-editor) 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) blockquote p:last-child {
  margin-bottom: 0;
}

:where(.playbook-item-markdown, .markdown-editor) 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) blockquote blockquote {
  margin: var(--md-space-1) 0;
  background: var(--md-bg-canvas);
}

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

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

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

:where(.playbook-item-markdown, .markdown-editor) 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) 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) tbody tr:last-child td {
  border-bottom: none;
}

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

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

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

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

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

:where(.playbook-item-markdown, .markdown-editor) .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) .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) .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) .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) img {
  max-width: 100%;
  height: auto;
  margin: var(--md-space-2) 0;
}

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

:where(.playbook-item-markdown, .markdown-editor) 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) .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) .mermaid svg {
  max-width: 100%;
  height: auto;
}

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

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

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

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

:where(.playbook-item-markdown, .markdown-editor) 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) 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) 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) .text-center { text-align: center; }
:where(.playbook-item-markdown, .markdown-editor) .text-right { text-align: right; }
:where(.playbook-item-markdown, .markdown-editor) .text-left { text-align: left; }

/* Lead paragraph styling */
:where(.playbook-item-markdown, .markdown-editor) > 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) {
    --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) a {
    text-decoration: underline;
  }
  
  :where(.playbook-item-markdown, .markdown-editor) pre,
  :where(.playbook-item-markdown, .markdown-editor) .highlight,
  :where(.playbook-item-markdown, .markdown-editor) .mermaid {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }
  

}
.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: #0d9488; /* teal-600 */
  --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;
  }
}
/* Original styles with modifications marked */

/* --- Base (Light) Theme --- */
perspective-workspace,
perspective-viewer,
perspective-copy-menu,
perspective-export-menu,
perspective-dropdown,
perspective-date-column-style,
perspective-datetime-column-style,
perspective-number-column-style,
perspective-string-column-style {
    /* --- SVG Icon Variables (Unchanged) --- */
    --column-type-integer--mask-image: url(/svg/number-type.svg);
    --column-type-float--mask-image: var(--column-type-integer--mask-image);
    --column-type-string--mask-image: url(/svg/string-type.svg);
    --column-type-date--mask-image: url(/svg/date-type.svg);
    --column-type-boolean--mask-image: url(/svg/boolean-type.svg);
    --column-type-datetime--mask-image: var(--column-type-date--mask-image);
    --column-drag-handle--mask-image: url(/svg/drag-handle.svg);
    --column-radio-on--mask-image: url(/svg/radio-on.svg);
    --column-radio-hover--mask-image: url(/svg/radio-hover.svg);
    --column-radio-off--mask-image: url(/svg/radio-off.svg);
    --column-checkbox-on--mask-image: url(/svg/checkbox-on.svg);
    --column-checkbox-hover--mask-image: url(/svg/checkbox-hover.svg);
    --column-checkbox-off--mask-image: url(/svg/checkbox-off.svg);
    --column-settings-icon--mask-image: url(/svg/column-settings-icon.svg);
    --sort-asc-icon--mask-image: url(/svg/sort-asc-icon.svg);
    --sort-desc-icon--mask-image: url(/svg/sort-desc-icon.svg);
    --sort-col-asc-icon--mask-image: url(/svg/sort-col-asc-icon.svg);
    --sort-col-desc-icon--mask-image: url(/svg/sort-col-desc-icon.svg);
    --sort-abs-asc-icon--mask-image: url(/svg/sort-abs-asc-icon.svg);
    --sort-abs-desc-icon--mask-image: url(/svg/sort-abs-desc-icon.svg);
    --sort-abs-col-asc-icon--mask-image: url(/svg/sort-abs-col-asc-icon.svg);
    --sort-abs-col-desc-icon--mask-image: url(/svg/sort-abs-col-desc-icon.svg);
    --sort-none-icon--mask-image: url(/svg/sort-none-icon.svg);
    --add-expression-icon--mask-image: url(/svg/expression.svg);
    --close-icon--mask-image: url(/svg/close-icon.svg);
    --inactive-column-selector--content: url(/svg/checkbox-unchecked-icon.svg);
    --active-column-selector--content: url(/svg/checkbox-checked-icon.svg);
    --select-arrow-light--background-image: url(/svg/dropdown-selector-light.svg);
    --select-arrow-dark--background-image: url(/svg/dropdown-selector.svg);
    --overflow-hint-icon--content: "!";
    --reset-button-icon--content: "refresh";
    --save-button-icon--content: "save";
    --updating-icon--mask-image: url(/svg/updating.gif);
    --downloading-icon--mask-image: url(/svg/downloading.gif);
    --status-ok-icon--mask-image: url(/svg/status_ok.svg);
    --export-icon--mask-image: url(/svg/export-icon.svg);
    --free-scroll-icon--mask-image: url(/svg/free-scroll-icon.svg);
    --reset-icon--mask-image: url(/svg/revert-icon.svg);
    --copy-icon--mask-image: url(/svg/duplicate-icon.svg);
    --theme-icon--mask-image: url(/svg/theme-icon.svg);
    --drawer-tab-icon--mask-image: url(/svg/drawer-tab.svg);
    --drawer-tab-icon--hover--mask-image: url(/svg/drawer-tab-hover.svg);
    --drawer-tab-inverted-icon--mask-image: url(/svg/drawer-tab-invert.svg);
    --drawer-tab-inverted-icon--hover--mask-image: url(/svg/drawer-tab-invert-hover.svg);

    /* --- Plugin Selector Icons (Unchanged) --- */
    --plugin-selector-candlestick--content: url(/svg/mega-menu-icons-candlestick.svg);
    --plugin-selector-heatmap--content: url(/svg/mega-menu-icons-heatmap.svg);
    --plugin-selector-map-scatter--content: url(/svg/mega-menu-icons-map-scatter.svg);
    --plugin-selector-ohlc--content: url(/svg/mega-menu-icons-ohlc.svg);
    --plugin-selector-sunburst--content: url(/svg/mega-menu-icons-sunburst.svg);
    --plugin-selector-treemap--content: url(/svg/mega-menu-icons-treemap.svg);
    --plugin-selector-x-bar--content: url(/svg/mega-menu-icons-x-bar.svg);
    --plugin-selector-x-y-line--content: url(/svg/mega-menu-icons-x-y-line.svg);
    --plugin-selector-x-y-scatter--content: url(/svg/mega-menu-icons-x-y-scatter.svg);
    --plugin-selector-y-area--content: url(/svg/mega-menu-icons-y-area.svg);
    --plugin-selector-y-bar--content: url(/svg/mega-menu-icons-y-bar.svg);
    --plugin-selector-y-line--content: url(/svg/mega-menu-icons-y-line.svg);
    --plugin-selector-y-scatter--content: url(/svg/mega-menu-icons-y-scatter.svg);
    --plugin-selector-datagrid--content: url(/svg/mega-menu-icons-datagrid.svg);

    /* --- Base Light Theme Styles --- */
    color: #161616;
    background-color: #ffffff;
    --icon--color: #008080;
    --inactive--color: #ababab;
    --inactive--border-color: #dadada;
    --root--background: #ffffff;
    --active--color: #008080;       /* teal as main accent */
    --error--color: #e57373;        /* red ONLY for errors */
    --plugin--background: #ffffff;
    --overflow-hint-icon--color: rgba(0, 0, 0, 0.2);
    --select--background-color: none;
    --column-drop-container--background: none;
    --warning--background: #042121;
    --warning--color: #fdfffd;
    --overflow-hint-icon--color: #fdfffd;
    --column-style-open-button--content: "style";
    --column-style-close-button--content: ">\00a0 style";
    --tree-label-collapse--content: "-";
    --tree-label-expand--content: "+";

    /* --- Patterned Sidebar Background --- */
    --plugin--background--pattern: url(/svg/bg-pattern.png);
    --sidebar--background: var(--plugin--background);

    /* --- Toolbar Icons (Unchanged) --- */
    --toolbar-scroll-lock--content: url(/svg/free-scroll-icon.svg);
    --toolbar-scroll-lock-active--content: url(/svg/align-scroll-icon.svg);
    --toolbar-edit-mode--read-only--content: url(/svg/read-only-icon.svg);
    --toolbar-edit-mode--edit--content: url(/svg/editable-icon.svg);
    --toolbar-edit-mode--select-row--content: url(/svg/datagrid-select-row.svg);
    --toolbar-edit-mode--select-column--content: url(/svg/datagrid-select-column.svg);
    --toolbar-edit-mode--select-region--content: url(/svg/datagrid-select-region.svg);

    /* --- Additional Styles for Light Mode --- */
    --rt-pos-cell--color: #008080;
    --rt-neg-cell--color: #7a0505; /* changed from red to blue */
    --d3fc-legend--text: #61656e;
    --d3fc-treedata--labels: #161616;
    --d3fc-treedata--hover-highlight: #2670a9;
    --d3fc-tooltip--color: #161616;
    --d3fc-axis-ticks--color: #61656e;
    --d3fc-axis--lines: #dadada;
    --d3fc-gridline--color: #dadada;
    --d3fc-tooltip--background: #ffffff;
    --d3fc-tooltip--border-color: #dadada;
    --d3fc-legend--background: var(--plugin--background);
    --d3fc-series:   #008080;
    --d3fc-series-1: #008080;
    --d3fc-series-2: #1febe1;
    --d3fc-series-3: #ff0404;
    --d3fc-series-4: #e18ee1;
    --d3fc-series-5: #61656e;
    --d3fc-series-6: #F7BD63;
    --d3fc-series-7: #000dff;
    --d3fc-series-8: #f16603;
    --d3fc-series-9: #11f009;
    --d3fc-full--gradient:     linear-gradient(#EE6969 0%, #ffffff 50%, #008080 100%);
    --d3fc-positive--gradient: linear-gradient(#ffffff 0%, #008080 100%);
    --d3fc-negative--gradient: linear-gradient(#EE6969 0%, #ffffff 100%);
    --map-tile-url: "http://{a-c}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png";
    --map-attribution--filter: none;
    --map-element-background: #ffffff;
    --map-category-1:  #008080;
    --map-category-2:  #1febe1;
    --map-category-3:  #ff0404;
    --map-category-4:  #e18ee1;
    --map-category-5:  #61656e;
    --map-category-6:  #F7BD63;
    --map-category-7:  #000dff;
    --map-category-8:  #f16603;
    --map-category-9:  #11f009;
    --map-category-10: #ee0d7e;
    --map-gradient: linear-gradient(#EE6969 0%, #ffffff 50%, #008080 100%);
}

perspective-viewer,
perspective-dropdown {
    /* --- Label/Content Variables (Unchanged) --- */
    --group-by-label--content: "Group By / Rows";
    --split-by-label--content: "Split By / Columns";
    --sort-label--content: "Sort by";
    --filter-label--content: "Filters";
    --transpose-button--content: "Swap";
    --config-button-icon--content: "configure";
    --all-columns-label--content: "All Columns / Values";
    --untitled--content: "untitled";
    --plugin-name-datagrid--content: "Datagrid";
    --plugin-name-treemap--content: "Treemap";
    --plugin-name-sunburst--content: "Sunburst";
    --plugin-name-heatmap--content: "Heatmap";
    --plugin-name-x-bar--content: "X Bar";
    --plugin-name-y-bar--content: "Y Bar";
    --plugin-name-y-line--content: "Y Line";
    --plugin-name-x-y-line--content: "X/Y Line";
    --plugin-name-x-y-scatter--content: "X/Y Scatter";
    --plugin-name-y-scatter--content: "Y Scatter";
    --plugin-name-y-area--content: "Y Area";
    --plugin-name-ohlc--content: "OHLC";
    --plugin-name-candlestick--content: "Candlestick";
    --column-selector-column-columns--content: "Columns / Values";
    --column-selector-column-x-axis--content: "X Axis";
    --column-selector-column-y-axis--content: "Y Axis";
    --column-selector-column-color--content: "Color";
    --column-selector-column-size--content: "Size";
    --column-selector-column-symbol--content: "Symbol";
    --column-selector-column-label--content: "Label";
    --column-selector-column-tooltip--content: "Tooltip";
    --add-expression-button--content: "New Column";
    --no-results--content: "Invalid Column";
    --datagrid-column-edit-button--content: "Edit";
    --copy-button--content: "Copy";
    --export-button--content: "Export";
    --reset-button--content: "Reset";
    --edit-mode--read-only--content: "Read Only";
    --edit-mode--edit--content: "Text Edit";
    --edit-mode--select-row--content: "Select Row";
    --edit-mode--select-column--content: "Select Column";
    --edit-mode--select-region--content: "Select Region";
    --scroll-lock-toggle--content: "Free Scroll";
    --scroll-lock-alt-toggle--content: "Align Scroll";
    --color-label--content: "Color";
    --format-label--content: "Format";
    --timezone-label--content: "Timezone";
    --date-style-label--content: "Date Style";
    --time-style-label--content: "Time Style";
    --foreground-label--content: "Foreground";
    --background-label--content: "Background";
    --series-label--content: "Series";
    --color-range-label--content: "Color Range";
    --style-label--content: "Style";
    --minimum-integer-digits-label--content: "Minimum Integer Digits";
    --rounding-increment-label--content: "Rounding Increment";
    --notation-label--content: "Notation";
    --use-grouping-label--content: "Use Grouping";
    --sign-display-label--content: "Sign Display";
    --max-value-label--content: "Max Value";
    --rounding-priority-label--content: "Rounding Priority";
    --rounding-mode-label--content: "Rounding Mode";
    --trailing-zero-display-label--content: "Trailing Zero Display";
    --fractional-digits-label--content: "Fractional Digits";
    --significant-digits-label--content: "Significant Digits";
    --year-label--content: "Year";
    --month-label--content: "Month";
    --day-label--content: "Day";
    --weekday-label--content: "Weekday";
    --hour-label--content: "Hour";
    --minute-label--content: "Minute";
    --second-label--content: "Second";
    --fractional-seconds-label--content: "Fractional Seconds";
    --hours-label--content: "12/24 Hours";
    --style-tab-label--content: "Style";
    --attributes-tab-label--content: "Attributes";
    --debug-tab-label--content: "Debug JSON";
}

/* --- Light Theme for Menus/Dropdowns --- */
perspective-copy-menu,
perspective-export-menu,
perspective-dropdown,
perspective-date-column-style,
perspective-datetime-column-style,
perspective-number-column-style,
perspective-string-column-style {
    border-radius: 0 0 2px 2px;
    --column-style-pos-color--content: "+";
    --column-style-neg-color--content: "-";
    --save-button-icon--content: "save";
    --reset-button-icon--content: "refresh";
    font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    --interface-monospace--font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    background-color: #ffffff;
    color: #161616;
    border: 1px solid #dadada;
    --icon--color: #008080;
    --active--color: #008080;
    --error--color: #e57373;
    --expression--function-color: #008080;
    --expression--error-color: #e57373;
    --code-editor-literal--color: #008080;
    --code-editor-operator--color: #22a0ce;
}

/* Host select arrow (light) */
:host select {
    background-image: url(/svg/chevron-down.svg);
    filter: none;
}

/* Workspace theme indicator (light) */
perspective-workspace,
perspective-indicator {
    --theme-name: "Pro Light Enhanced";
}

/* Status bar height (shared) */
perspective-workspace perspective-viewer {
    --status-bar--height: 39px;
}

/* Style viewer inside workspace when settings are open (shared) */
perspective-workspace perspective-viewer[settings] {
    --modal-panel--margin: -4px 0 -4px 0;
    --status-bar--border-radius: 6px 0 0 0;
    --main-column--margin: 3px 0 3px 3px;
    --main-column--border: none;
    --main-column--border-width: 0px;
    --main-column--border-radius: 6px 0 0 6px;
    --settings-button--margin: 10px 0 0 0;
}

/* --- Workspace Light Theme Enhancements --- */
perspective-workspace {
    font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    --open-settings-button--content: "expand_more";
    --close-settings-button--content: "expand_less";
    --close-button--content: "\2715";
    --master-divider--background-color: #dadada;
    --menu-maximize--content: "fullscreen";
    --menu-minimize--content: "fullscreen_exit";
    --menu-duplicate--content: "call_split";
    --menu-master--content: "cast";
    --menu-detail--content: "notes";
    --menu-export--content: "file_download";
    --menu-copy--content: "file_copy";
    --menu-reset--content: "autorenew";
    --menu-link--content: "link";
    --menu-unlink--content: "link_off";
    --menu-newmenu--content: "add";
    --menu-close--content: "close";
    --menu-new--content: "description";
    --menu-newview--content: "file_copy";
    --column-drag-handle--mask-image: url(/svg/drag-handle.svg);
    --bookmarks--mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMTEiIHZpZXdCb3g9IjAgMCAyNCAxMSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoIGQ9Ik0zLjY2MjE0IDYuOTY0NzZMMC41IDkuODYzMzhWMC41SDcuNVY5Ljg2MzM4TDQuMzM3ODYgNi45NjQ3Nkw0IDYuNjU1MDVMMy42NjIxNCA2Ljk2NDc2WiIgc3Ryb2tlPSIjMTYxNjE2Ii8+CiAgICA8cGF0aCBkPSJNMTkgNEwyMSA2TDIzIDQiIHN0cm9rZT0iIzE2MTYxNiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPgo=");

    --workspace-tabbar--border: 1px solid #dadada;
    --workspace-tabbar--border-width: 1px;
    --workspace-tabbar--border-radius: 0px 0px 6px 6px;
    --workspace-tabbar-tab--border-width: 1px 1px 0 1px;

    background-color: #ffffff;
    color: #161616;
    --workspace-split-panel-handle--background-color: #ffffff;
    --icon--color: #008080;
    --active--color: #008080;
    --error--color: #e57373;
    --expression--function-color: #008080;
    --expression--error-color: #e57373;
    --code-editor-literal--color: #008080;
    --code-editor-operator--color: #22a0ce;
    --workspace-tabbar--background-color: #ffffff;
    --workspace-secondary--color: #61656e;
    --workspace-tabbar--border-color: #dadada;
}

/* Ensure viewer background within master widget matches workspace (light) */
perspective-viewer.workspace-master-widget {
    --plugin--background: #ffffff;
}

perspective-viewer {
    --icon--color: #008080;
}
perspective-workspace-menu {
    --icon--color: #008080;
}

/* Workspace Menu (light) */
perspective-workspace-menu {
    font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    font-weight: 300;
    background: #ffffff !important;
    color: #161616 !important;
    border: 1px solid #dadada !important;
}

/* --- DARK THEME OVERRIDES --- */
.dark perspective-workspace,
.dark perspective-copy-menu,
.dark perspective-export-menu,
.dark perspective-dropdown,
.dark perspective-date-column-style,
.dark perspective-datetime-column-style,
.dark perspective-number-column-style,
.dark perspective-string-column-style {
    color: white;
    background-color: #030712;
    --icon--color: white;
    --inactive--color: #61656e;
    --inactive--border-color: #1f2937;
    --root--background: #030712;
    --active--color: #2770a9;
    --error--color: #ff9485;
    --plugin--background: #030712;
    --overflow-hint-icon--color: rgba(0, 0, 0, 0.2);
    --select--background-color: none;
    --column-drop-container--background: none;
    --warning--background: var(--icon--color);
    --warning--color: #030712;
    --overflow-hint-icon--color: #fdfffd;
    --column-style-open-button--content: "style";
    --column-style-close-button--content: ">\00a0 style";
    --tree-label-collapse--content: "-";
    --tree-label-expand--content: "+";
    /* Toolbar Icons and plugin selectors unchanged */
}

/* Dark theme viewer and dropdown rules consolidated above */

.dark perspective-viewer,
.dark perspective-viewer { /* duplicated for consistency */
    --theme-name: "Pro Dark Enhanced";
}

.dark perspective-viewer {
    font-family: "Inter var", "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    --interface-monospace--font-family: "Inter var", "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    background-color: #030712;
    color: white;
    --icon--color: white;
    --active--color: #2770a9;
    --error--color: #ff9485;
    --inactive--color: #61656e;
    --inactive--border-color: #1f2937;
    --plugin--background: #030712;
    --root--background: #030712;
    --modal-target--background: rgba(255, 255, 255, 0.05);
    --active--background: rgba(39, 113, 170, 0.5);
    --expression--operator-color: #c5c9d0;
    --expression--function-color: #22a0ce;
    --expression--error-color: rgb(255, 136, 136);
    --calendar--filter: invert(1);
    --warning--color: #030712;
    --warning--background: var(--icon--color);
    --select-arrow--background-image: var(--select-arrow-light--background-image);
    --code-editor-symbol--color: white;
    --code-editor-literal--color: #7dc3f0;
    --code-editor-operator--color: rgb(23, 166, 123);
    --code-editor-comment--color: rgb(204, 120, 48);
    --code-editor-column--color: #e18ee1;
    --rt-pos-cell--color: #7dc3f0;
    --rt-neg-cell--color: #ff9485;
    /* d3fc and map colors as in your dark theme */
    --d3fc-legend--text: #B2B7BD;
    --d3fc-treedata--labels: #E5E7E9;
    --d3fc-treedata--hover-highlight: #FFFFFF;
    --d3fc-tooltip--color: #FFFFFF;
    --d3fc-axis-ticks--color: #A2A4A4;
    --d3fc-axis--lines: #4C5864;
    --d3fc-gridline--color: #1f2937;
    --d3fc-tooltip--background: #1D262F;
    --d3fc-tooltip--border-color: #31404E;
    --d3fc-legend--background: var(--plugin--background);
    --d3fc-series:   #00B5AD;
    --d3fc-series-1: #14B8A6;
    --d3fc-series-2: #3B82F6;
    --d3fc-series-3: #EF4444;
    --d3fc-series-4: #A855F7;
    --d3fc-series-5: #D1D5DB;
    --d3fc-series-6: #FBBF24;
    --d3fc-series-7: #22C55E;
    --d3fc-series-8: #FB923C;
    --d3fc-series-9: #0707f3;
    --d3fc-series-10: #F472B6;
    --d3fc-full--gradient:     linear-gradient(#EE6969 0%, #030712 50%, #00B5AD 100%);
    --d3fc-positive--gradient: linear-gradient(#030712 0%, #00B5AD 100%);
    --d3fc-negative--gradient: linear-gradient(#EE6969 0%, #030712 100%);
    --map-tile-url: "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png";
    --map-attribution--filter: invert(1) hue-rotate(180deg);
    --map-element-background: #1D262F;
    --map-category-1:  #14B8A6;
    --map-category-2:  #3B82F6;
    --map-category-3:  #EF4444;
    --map-category-4:  #A855F7;
    --map-category-5:  #D1D5DB;
    --map-category-6:  #FBBF24;
    --map-category-7:  #22C55E;
    --map-category-8:  #fb3cbe;
    --map-category-9:  #0410ee;
    --map-category-10: #ccf000;
    --map-gradient: linear-gradient(#EE6969 0%, #030712 50%, #00B5AD 100%);
}

.dark perspective-copy-menu,
.dark perspective-export-menu,
.dark perspective-dropdown,
.dark perspective-date-column-style,
.dark perspective-datetime-column-style,
.dark perspective-number-column-style,
.dark perspective-string-column-style {
    background-color: #1f2937;
    color: white;
    border: 1px solid #374151;
    --icon--color: white;
    --active--color: #2770a9;
    --error--color: #ff9485;
    --inactive--color: #61656e;
    --inactive--border-color: #4c505b;
    --plugin--background: #1f2937;
    --modal-target--background: rgba(255, 255, 255, 0.05);
    --active--background: rgba(39, 113, 170, 0.5);
    --expression--operator-color: #c5c9d0;
    --expression--function-color: #22a0ce;
    --expression--error-color: rgb(255, 136, 136);
    --calendar--filter: invert(1);
    --warning--color: #1f2937;
    --warning--background: var(--icon--color);
    --select-arrow--background-image: var(--select-arrow-light--background-image);
    --code-editor-symbol--color: white;
    --code-editor-literal--color: #7dc3f0;
    --code-editor-operator--color: rgb(23, 166, 123);
    --code-editor-comment--color: rgb(204, 120, 48);
    --code-editor-column--color: #e18ee1;
}

.dark :host select {
    background-image: url(/svg/chevron-down.svg);
    filter: invert(1);
}

.dark perspective-workspace,
.dark perspective-indicator {
    --theme-name: "Pro Dark Enhanced";
}

.dark perspective-workspace {
    font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    --open-settings-button--content: "expand_more";
    --close-settings-button--content: "expand_less";
    --close-button--content: "\2715";
    --master-divider--background-color: #243136;
    --menu-maximize--content: "fullscreen";
    --menu-minimize--content: "fullscreen_exit";
    --menu-duplicate--content: "call_split";
    --menu-master--content: "cast";
    --menu-detail--content: "notes";
    --menu-export--content: "file_download";
    --menu-copy--content: "file_copy";
    --menu-reset--content: "autorenew";
    --menu-link--content: "link";
    --menu-unlink--content: "link_off";
    --menu-newmenu--content: "add";
    --menu-close--content: "close";
    --menu-new--content: "description";
    --menu-newview--content: "file_copy";
    --column-drag-handle--mask-image: url(/svg/drag-handle.svg);
    --bookmarks--mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMTEiIHZpZXdCb3g9IjAgMCAyNCAxMSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxwYXRoIGQ9Ik0zLjY2MjE0IDYuOTY0NzZMMC41IDkuODYzMzhWMC41SDcuNVY5Ljg2MzM4TDQuMzM3ODYgNi45NjQ3Nkw0IDYuNjU1MDVMMy42NjIxNCA2Ljk2NDc2WiIgc3Ryb2tlPSIjRkZGRkZGIi8+CiAgICA8cGF0aCBkPSJNMTkgNEwyMSA2TDIzIDQiIHN0cm9rZT0iI0ZGRkZGRiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPgo=");
    --workspace-tabbar--border: none;
    --workspace-tabbar--border-width: 0px;
    --workspace-tabbar--border-radius: 0px 0px 6px 6px;
    --workspace-tabbar-tab--border-width: 1px 1px 0 1px;
    background-color: #030712;
    color: white;
    --workspace-split-panel-handle--background-color: #030712;
    --icon--color: white;
    --active--color: #2770a9;
    --error--color: #ff9485;
    --inactive--color: #6b7280;
    --inactive--border-color: #374151;
    --plugin--background: #030712;
    --root--background: #030712;
    --modal-target--background: rgba(255, 255, 255, 0.05);
    --active--background: rgba(39, 113, 170, 0.5);
    --expression--operator-color: #d1d5db;
    --expression--function-color: #22a0ce;
    --expression--error-color: rgb(255, 136, 136);
    --calendar--filter: invert(1);
    --warning--color: #030712;
    --warning--background: var(--icon--color);
    --select-arrow--background-image: var(--select-arrow-light--background-image);
    --code-editor-symbol--color: white;
    --code-editor-literal--color: #7dc3f0;
    --code-editor-operator--color: rgb(23, 166, 123);
    --code-editor-comment--color: rgb(204, 120, 48);
    --code-editor-column--color: #e18ee1;
    --workspace-tabbar--background-color: #030712;
    --workspace-secondary--color: #9ca3af;
    --workspace-tabbar--border-color: var(--inactive--border-color);
    --workspace-tabbar-tab--border-width: 1px 1px 0 1px;
}

.dark perspective-viewer.workspace-master-widget {
    --plugin--background: #030712;
}

.dark perspective-workspace-menu {
    font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    font-weight: 300;
    background: #1f2937 !important;
    color: white !important;
    border: 1px solid #374151 !important;
}
/*
 * 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.
 *


 */
