/* GitHub-style diff display */
.diff-container {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 20px;
  background: #f6f8fa;
  border-radius: 8px;
  overflow: hidden;
}

.diff-container .diff {
  margin: 0;
  background: transparent;
}

.diff-container .diff ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #ffffff;
}

.diff-container .diff li {
  padding: 0 10px 0 44px;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  border-left: 1px solid #d1d9e0;
}

.diff-container .diff li:before {
  content: attr(data-line-number);
  position: absolute;
  left: 10px;
  width: 24px;
  text-align: right;
  color: #656d76;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.diff-container .diff .del {
  background-color: #ffebe9;
  color: #1f2328;
}

.diff-container .diff .del:before {
  content: "-";
  color: #d1242f;
}

.diff-container .diff .ins {
  background-color: #dafbe1;
  color: #1f2328;
}

.diff-container .diff .ins:before {
  content: "+";
  color: #0969da;
}

.diff-container .diff .unchanged {
  background-color: #ffffff;
  color: #656d76;
}

.diff-container .diff .del strong {
  background-color: #ffd8d3;
  color: #d1242f;
  font-weight: 600;
}

.diff-container .diff .ins strong {
  background-color: #abf2bc;
  color: #0969da;
  font-weight: 600;
}

/* Dark mode styles */
.dark .diff-container {
  background: #161b22;
}

.dark .diff-container .diff ul {
  background: #0d1117;
}

.dark .diff-container .diff li {
  border-left-color: #30363d;
}

.dark .diff-container .diff li:before {
  color: #7d8590;
}

.dark .diff-container .diff .del {
  background-color: #67060c;
  color: #f0f6fc;
}

.dark .diff-container .diff .del:before {
  color: #ff7b72;
}

.dark .diff-container .diff .ins {
  background-color: #033a16;
  color: #f0f6fc;
}

.dark .diff-container .diff .ins:before {
  color: #3fb950;
}

.dark .diff-container .diff .unchanged {
  background-color: #0d1117;
  color: #7d8590;
}

.dark .diff-container .diff .del strong {
  background-color: #86181d;
  color: #ff7b72;
}

.dark .diff-container .diff .ins strong {
  background-color: #164929;
  color: #3fb950;
}

/* Header styling */
.diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #f6f8fa;
  border-bottom: 1px solid #d1d9e0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #656d76;
}

.dark .diff-header {
  background: #21262d;
  border-bottom-color: #30363d;
  color: #7d8590;
}

.diff-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.diff-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.diff-stat-additions {
  background-color: #1f883d;
}

.diff-stat-deletions {
  background-color: #d1242f;
}
/* lexxy variables */

:root {
  /* Colors */
  --lexxy-color-ink: oklch(20% 0 0);
  --lexxy-color-ink-medium: oklch(40% 0 0);
  --lexxy-color-ink-light: oklch(60% 0 0);
  --lexxy-color-ink-lighter: oklch(85% 0 0);
  --lexxy-color-ink-lightest: oklch(96% 0 0);
  --lexxy-color-ink-inverted: white;

  --lexxy-color-accent-dark: oklch(57% 0.19 260);
  --lexxy-color-accent-medium: oklch(75% 0.196 258);
  --lexxy-color-accent-light: oklch(88% 0.026 254);
  --lexxy-color-accent-lightest: oklch(92% 0.026 254);

  --lexxy-color-red: oklch(60% 0.15 27);
  --lexxy-color-green: oklch(60% 0.15 145);
  --lexxy-color-blue: oklch(66% 0.196 258);
  --lexxy-color-purple: oklch(60% 0.15 305);

  --lexxy-color-code-token-att: #d73a49;
  --lexxy-color-code-token-comment: #6a737d;
  --lexxy-color-code-token-function: #6f42c1;
  --lexxy-color-code-token-operator: #d73a49;
  --lexxy-color-code-token-property: #005cc5;
  --lexxy-color-code-token-punctuation: #24292e;
  --lexxy-color-code-token-selector: #22863a;
  --lexxy-color-code-token-variable: #e36209;

  --lexxy-color-canvas: var(--lexxy-color-ink-inverted);
  --lexxy-color-text: var(--lexxy-color-ink);
  --lexxy-color-text-subtle: var(--lexxy-color-ink-medium);
  --lexxy-color-link: var(--lexxy-color-accent-dark);
  --lexxy-color-selected: var(--lexxy-color-accent-lightest);
  --lexxy-color-selected-hover: var(--lexxy-color-accent-light);
  --lexxy-color-selected-dark: var(--lexxy-color-blue);
  --lexxy-color-code-bg: var(--lexxy-color-ink-lightest);

  /* Text color highlights */
  --highlight-1: rgb(136, 118, 38);
  --highlight-2: rgb(185, 94, 6);
  --highlight-3: rgb(207, 0, 0);
  --highlight-4: rgb(216, 28, 170);
  --highlight-5: rgb(144, 19, 254);
  --highlight-6: rgb(5, 98, 185);
  --highlight-7: rgb(17, 138, 15);
  --highlight-8: rgb(148, 82, 22);
  --highlight-9: rgb(102, 102, 102);

  --highlight-bg-1: rgba(229, 223, 6, 0.3);
  --highlight-bg-2: rgba(255, 185, 87, 0.3);
  --highlight-bg-3: rgba(255, 118, 118, 0.3); 
  --highlight-bg-4: rgba(248, 137, 216, 0.3);
  --highlight-bg-5: rgba(190, 165, 255, 0.3); 
  --highlight-bg-6: rgba(124, 192, 252, 0.3);
  --highlight-bg-7: rgba(140, 255, 129, 0.3); 
  --highlight-bg-8: rgba(221, 170, 123, 0.3);
  --highlight-bg-9: rgba(200, 200, 200, 0.3);

  /* Tables */
  --lexxy-color-table-header-bg: var(--lexxy-color-ink-lightest);
  --lexxy-color-table-cell-border: var(--lexxy-color-ink-lighter);
  --lexxy-color-table-cell-selected: var(--lexxy-color-selected);
  --lexxy-color-table-cell-selected-border: highlight;
  --lexxy-color-table-cell-selected-bg: highlight;

  /* Typography */
  --lexxy-font-base: system-ui, sans-serif;
  --lexxy-font-mono: ui-monospace, "Menlo", "Monaco", Consolas, monospace;
  --lexxy-text-small: 0.875rem;
  --lexxy-content-margin: 1rem;

  /* Focus ring */
  --lexxy-focus-ring-color: var(--lexxy-color-accent-dark);
  --lexxy-focus-ring-offset: 0;
  --lexxy-focus-ring-size: 2px;

  /* Misc */
  --lexxy-radius: 0.5ch;
  --lexxy-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --lexxy-z-popup: 1000;
}

/* lexxy content */

/* Text styles
/* -------------------------------------------------------------------------- */

:where(.lexxy-content) {
  color: var(--lexxy-color-ink);

  ul,
  ol {
      list-style: revert;
      margin: revert;
      padding: revert;
  }        h1, h2, h3, h4, h5, h6 {
      font-size: revert;
      font-weight: revert;
      margin: revert;
  }
  strong {
      font-weight: revert;
  }
  em {
      font-style: revert;
  }

  h1, h2, h3, h4, h5, h6 {
    display: block;
    font-weight: bold;
    hyphens: auto;
    margin-block: 0 var(--lexxy-content-margin);
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 0.875rem; }
  h6 { font-size: 0.75rem; }

  p,
  ul,
  ol,
  dl,
  blockquote,
  figure,
  .attachment {
    margin-block: 0 var(--lexxy-content-margin);

    &:not(lexxy-editor &) {
      overflow-wrap: break-word;
      text-wrap: pretty;
    }
  }

  .lexxy-content__italic {
    font-style: italic;
  }

  .lexxy-content__bold {
    font-weight: bold;
  }

  .lexxy-content__strikethrough {
    text-decoration: line-through;
  }

  .lexxy-content__underline {
    text-decoration: underline;
  }

  mark,
  .lexxy-content__highlight {
    background-color: transparent;
    color: inherit;
  }

  blockquote {
    border-inline-start: 0.25em solid var(--lexxy-color-ink-lighter);
    font-style: italic;
    margin: var(--lexxy-content-margin) 0;
    padding: 0.5lh 2ch;
  }

  p:empty {
    display: none;
  }

  a {
    color: var(--lexxy-color-link);
  }

  img,
  video,
  embed,
  object {
    inline-size: auto;
    margin-inline: auto;
    max-block-size: 32rem;
    object-fit: contain;

    a:has(&) {
      display: inline-block;
    }
  }

  code, pre {
    background-color: var(--lexxy-color-ink-lightest);
    border-radius: var(--lexxy-radius);
    color: var(--lexxy-color-ink);
    font-family: var(--lexxy-font-mono);
    font-size: 0.9em;
    padding: 0.25ch 0.5ch;

    &:is(pre),
    &[data-language] {
      border-radius: var(--lexxy-radius);
      display: block;
      hyphens: none;
      margin-block: 0 var(--lexxy-content-margin);
      overflow-x: auto;
      padding: 1ch;
      tab-size: 2;
      text-wrap: nowrap;
      white-space: pre;
      word-break: break-word;
    }
  }

  li.lexxy-nested-listitem {
    list-style-type: none;

    ol, ul {
      margin: 0;
    }
  }

  > :last-child {
    margin-block-end: 0;
  }

  /* Keywords and attributes */
  .code-token__attr,
  .token.atrule,
  .token.attr,
  .token.keyword {
    color: var(--lexxy-color-code-token-att);
  }

  /* Constants, booleans, numbers, properties, tags */
  .code-token__property,
  .token.boolean,
  .token.constant,
  .token.number,
  .token.property,
  .token.symbol,
  .token.tag {
    color: var(--lexxy-color-code-token-property);
  }

  /* Strings, selectors, and built-in constructs */
  .code-token__selector,
  .token.builtin,
  .token.char,
  .token.inserted,
  .token.line,
  .token.selector,
  .token.string {
    color: var(--lexxy-color-code-token-selector);
  }

  /* Comments and meta information */
  .code-token__comment,
  .token.cdata,
  .token.comment,
  .token.doctype,
  .token.prolog {
    color: var(--lexxy-color-code-token-comment);
    font-style: italic;
  }

  /* Operators and symbolic entities */
  .code-token__operator,
  .token.deleted,
  .token.entity,
  .token.operator,
  .token.url,
  code[data-language="diff"] .code-token__operator + .code-token__selector {
    color: var(--lexxy-color-code-token-operator);
  }

  /* Functions and class names */
  .code-token__function,
  .token.class,
  .token.class-name,
  .token.function {
    color: var(--lexxy-color-code-token-function);
  }

  /* Variables, regex, namespaces, important */
  .code-token__variable,
  .token.important,
  .token.namespace,
  .token.regex,
  .token.variable {
    color: var(--lexxy-color-code-token-variable);
  }

  /* Punctuation */
  .code-token__punctuation,
  .token.punctuation {
    color: var(--lexxy-color-code-token-punctuation);
  }

  /* Tables */
  :where(.lexxy-content__table-wrapper) {
    margin-block: 1ch;
    overflow-x: auto;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
    inline-size: calc(100% - 0.5ch);
    margin: 0.25ch;

    th,
    td {
      border: 1px solid var(--lexxy-color-ink-lighter);
      padding: 1ch;
      text-align: start;
      word-break: normal;
      
      *:last-child {
        margin-block-end: 0;
      }

      &.lexxy-content__table-cell--header {
        background-color: var(--lexxy-color-ink-lightest);
        font-weight: bold;
      }

      *:is(code, pre) {
        hyphens: auto;
        text-wrap: wrap;
        white-space: pre-wrap;
      }
    }
  }
}

:where([data-lexical-cursor]) {
  animation: blink 1s step-end infinite;
  block-size: 1lh;
  border-inline-start: 1px solid currentColor;
  line-height: inherit;
  margin-block: 1em;
}

/* Attachments
/* ------------------------------------------------------------------------ */

:where(.attachment) {
  block-size: auto;
  display: block;
  inline-size: fit-content;
  position: relative;
  margin-inline: auto;
  max-inline-size: 100%;
  text-align: center;

  :where(progress) {
    inline-size: 100%;
    margin: auto;
  }
}

:where(.attachment__caption) {
  color: var(--lexxy-color-text-subtle);
  font-size: var(--lexxy-text-small);

  textarea {
    background: var(--lexxy-color-canvas);
    border: none;
    color: inherit;
    font-family: inherit;
    inline-size: 100%;
    max-inline-size: 100%;
    resize: none;
    text-align: center;

    &:focus {
      outline: none;
    }

    @supports (field-sizing: content) {
      field-sizing: content;
      inline-size: auto;
      min-inline-size: 20ch;
    }
  }
}

:where(.attachment__icon) {
  aspect-ratio: 4/5;
  background-color: color-mix(var(--lexxy-attachment-icon-color), transparent 90%);
  block-size: 3lh;
  border: 2px solid var(--lexxy-attachment-icon-color);
  border-block-start-width: 1ch;
  border-radius: var(--lexxy-radius);
  box-sizing: border-box;
  color: var(--lexxy-attachment-icon-color);
  display: grid;
  font-size: var(--lexxy-text-small);
  font-weight: bold;
  inline-size: auto;
  place-content: center;
  text-transform: uppercase;
}

:where(.attachment--preview) {
  border-radius: var(--lexxy-radius);

  img, video {
    block-size: auto;
    display: block;
    margin-inline: auto;
    max-inline-size: 100%;
    user-select: none;
  }

  > a {
    display: block;
  }

  .attachment__caption {
    margin-block-start: 1ch;
  }
}

:where(.attachment--file) {
  --lexxy-attachment-icon-color: var(--lexxy-color-text-subtle);

  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1ch;
  inline-size: auto;

  .attachment__caption {
    display: grid;
    flex: 1;
    text-align: start;
  }

  .attachment__name {
    color: var(--lexxy-color-ink);
    font-weight: bold;
  }
}

:where(
  .attachment--psd,
  .attachment--key,
  .attachment--sketch,
  .attachment--ai,
  .attachment--eps,
  .attachment--indd,
  .attachment--svg,
  .attachment--ppt,
  .attachment--pptx
) {
  --lexxy-attachment-icon-color: var(--lexxy-color-red);
}

:where(
  .attachment--css,
  .attachment--php,
  .attachment--json,
  .attachment--htm,
  .attachment--html,
  .attachment--rb,
  .attachment--erb,
  .attachment--ts,
  .attachment--js
) {
  --lexxy-attachment-icon-color: var(--lexxy-color-purple);
}

:where(
  .attachment--txt,
  .attachment--pages,
  .attachment--rtf,
  .attachment--md,
  .attachment--doc,
  .attachment--docx
) {
  --lexxy-attachment-icon-color: var(--lexxy-color-blue);
}

:where(
  .attachment--csv,
  .attachment--numbers,
  .attachment--xls,
  .attachment--xlsx
) {
  --lexxy-attachment-icon-color: var(--lexxy-color-green);
}

/* Horizontal divider */
:where(.horizontal-divider) {
  margin: 0;
  margin-block-end: .5em;
  padding: 1.5em 0 .5em;

  hr {
    border: 0;
    border-block-end: 1px solid currentColor;
    inline-size: 20%;
    margin: 0;
  }
}

/* Custom attachments such as mentions, etc. */
:where(action-text-attachment[content-type^="application/vnd.actiontext"]) {
  --lexxy-attachment-bg-color: transparent;
  --lexxy-attachment-image-size: 1em;
  --lexxy-attachment-text-color: currentColor;

  align-items: center;
  background: var(--lexxy-attachment-bg-color);
  border-radius: var(--lexxy-radius);
  box-shadow: -0.25ch 0 0 var(--lexxy-attachment-bg-color), 0.5ch 0 0 var(--lexxy-attachment-bg-color);
  color: var(--lexxy-attachment-text-color);
  display: inline-flex;
  gap: 0.25ch;
  margin: 0;
  padding: 0;
  position: relative;
  white-space: normal;

  img {
    block-size: var(--lexxy-attachment-image-size);
    border-radius: 50%;
    inline-size: var(--lexxy-attachment-image-size);
  }

  &.node--selected {
    --lexxy-attachment-bg-color: var(--lexxy-color-accent-dark);
    --lexxy-attachment-text-color: var(--lexxy-color-ink-inverted);
  }
}

/* lexxy editor */

:where(lexxy-editor) {
  --lexxy-editor-padding: 1ch;
  --lexxy-editor-rows: 8lh;
  @supports (min-block-size: attr(rows lh)) {
    --lexxy-editor-rows: attr(rows lh, 8lh);
  }

  --lexxy-toolbar-gap: 2px;

  border: 1px solid var(--lexxy-color-ink-lighter);
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  background-color: var(--lexxy-color-canvas);
  display: block;
  overflow: visible;
  position: relative;
  transition: opacity 150ms;

  input,
  button,
  summary {
    &:focus-visible {
      outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
      outline-offset: var(--lexxy-focus-ring-offset);
    }
  }

  button,
  summary {
    -webkit-appearance: none;
    appearance: none;
    background: var(--lexxy-color-canvas);
    border: none;
    border-radius: var(--lexxy-radius);
    cursor: pointer;
    font-size: inherit;
    inline-size: auto;
    padding: 0;

    @media(any-hover: hover) {
      &:hover:not([aria-disabled="true"]) {
        background: var(--lexxy-color-ink-lightest);
      }
    }
  }

  .node--selected {
    &:has(img) img,
    &:not(:has(img)) {
      outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
      outline-offset: var(--lexxy-focus-ring-offset);
    }
  }

  table {
    .table-cell--selected {
      background-color: var(--lexxy-color-table-cell-selected-bg) !important;
    }

    .lexxy-content__table-cell--selected {
      background-color: var(--lexxy-color-table-cell-selected-bg) !important;
      border-color: var(--lexxy-color-table-cell-selected-border) !important;
    }
  
    &.lexxy-content__table--selection {
      ::selection {
        background: transparent;
      }
    }
  }

  action-text-attachment {
    cursor: pointer;
  }
}

/* Placeholder */
:where(.lexxy-editor--empty) {
  .lexxy-editor__content:not(:has(ul, ol))::before {
    content: attr(placeholder);
    color: currentColor;
    cursor: text;
    opacity: 0.66;
    pointer-events: none;
    position: absolute;
    white-space: pre-line;
  }
}

:where(.lexxy-editor__content) {
  min-block-size: var(--lexxy-editor-rows);
  outline: 0;
  padding: var(--lexxy-editor-padding);

  ul,
  ol {
      list-style: revert;
      margin: revert;
      padding: revert;
  }        h1, h2, h3, h4, h5, h6 {
      font-size: revert;
      font-weight: revert;
      margin: revert;
  }
  strong {
      font-weight: revert;
  }
  em {
      font-style: revert;
  }
}

:where(.lexxy-editor--drag-over) {
  background-color: var(--lexxy-color-selected);
  border-radius: var(--lexxy-radius);
  outline: 2px dashed var(--lexxy-color-selected-dark);
}

/* Toolbar
/* -------------------------------------------------------------------------- */

:where(lexxy-toolbar) {
  --lexxy-toolbar-icon-size: 1em;

  border-block-end: 1px solid var(--lexxy-color-ink-lighter);
  color: currentColor;
  display: flex;
  font-size: inherit;
  gap: var(--lexxy-toolbar-gap);
  max-inline-size: 100%;
  padding: 2px;
  position: relative;

  &[data-attachments="false"] button[name="upload"]{
    display: none;
  }
}

:where(.lexxy-editor__toolbar-button) {
  aspect-ratio: 1;
  block-size: 2lh;
  color: currentColor;
  display: grid;
  place-items: center;

  &:is(:active):not([aria-disabled="true"]),
  &[aria-pressed="true"] {
    background-color: var(--lexxy-color-selected);

    &:hover {
      background-color: var(--lexxy-color-selected-hover);
    }
  }

  &[aria-disabled="true"] {
    cursor: default;
    opacity: 0.3;
  }

  svg {
    -webkit-touch-callout: none;
    block-size: var(--lexxy-toolbar-icon-size);
    fill: currentColor;
    grid-area: 1/1;
    inline-size: var(--lexxy-toolbar-icon-size);
    user-select: none;
  }
}

:where(.lexxy-editor__toolbar-spacer) {
  flex: 1;
}

/* Make sure spacer is only displayed if there's another button before it */
* + :where(.lexxy-editor__toolbar-spacer) {
  min-inline-size: 1lh;
}

:where(.lexxy-editor__toolbar-overflow) {
  display: none;
  justify-self: flex-end;
  position: relative;
  z-index: 1;

  summary {
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    [open] & {
      background-color: var(--lexxy-color-ink-lightest);
    }
  }
}

:where(.lexxy-editor__toolbar-overflow-menu) {
  background-color: var(--lexxy-color-canvas);
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
  box-shadow: var(--lexxy-shadow);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--lexxy-toolbar-gap);
  inset-inline-end: 0;
  padding: var(--lexxy-toolbar-gap);
  position: absolute;

  .lexxy-editor__toolbar-spacer {
    display: none;
  }

  * + .lexxy-editor__toolbar-spacer + button {
    margin-left: 0.5lh;
  }
}

/* Dropdowns
/* -------------------------------------------------------------------------- */

:where(.lexxy-editor__toolbar-dropdown) {
  position: relative;
  user-select: none;
  -webkit-user-select: none;

  :where(.lexxy-editor__toolbar-dropdown-content) {
    --dropdown-padding: 1ch;
    --dropdown-gap: calc(var(--dropdown-padding) / 2);

    background-color: var(--lexxy-color-canvas);
    border: 2px solid var(--lexxy-color-selected-hover);
    border-radius: var(--lexxy-radius);
    border-start-start-radius: 0;
    box-sizing: border-box;
    color: var(--lexxy-color-ink);
    display: flex;
    gap: var(--dropdown-gap);
    inset-block-start: 2lh;
    inset-inline-start: 0;
    max-inline-size: 40ch;
    margin: 0;
    padding: var(--dropdown-padding);
    position: absolute;
    z-index: 3;
  }

  &:is([open]) .lexxy-editor__toolbar-button {
    background-color: var(--lexxy-color-selected-hover);
    border-end-end-radius: 0;
    border-end-start-radius: 0;

    &:hover {
      background-color: var(--lexxy-color-selected-hover);
    }
  }
  
  [overflowing] & {
    position: static;

    .lexxy-editor__toolbar-dropdown-content {
      --dropdown-padding: 0.5ch;
      inset-inline-end: var(--dropdown-padding);
      inset-inline-start: var(--dropdown-padding);
    }
  }
}

/* Link dropdown
/* -------------------------------------------------------------------------- */

:where(lexxy-link-dropdown) {

  > * { flex: 1; }

  .lexxy-editor__toolbar-dropdown-actions {
    display: flex;
    font-size: var(--lexxy-text-small);
    flex: 1 1 0%;
    gap: 1ch;
    margin-block-start: 1ch;
  }

  input[type="url"],
  button {
    padding-inline: 1ch;
  }

  input[type="url"] {
    background-color: var(--lexxy-color-canvas);
    border: 1px solid var(--lexxy-color-ink-lighter);
    border-radius: var(--lexxy-radius);
    color: var(--lexxy-color-text);
    box-sizing: border-box;
    inline-size: 100%;
    min-inline-size: 30ch;

    [overflowing] & {
      min-inline-size: 0;
    }
  }

  button {
    background-color: var(--lexxy-color-ink-lightest);
    color: var(--lexxy-color-text);
    inline-size: 100%;
    justify-content: center;
    line-height: normal;
    padding: 1ch 2ch;
  }

  button[type="submit"] {
    background-color: var(--lexxy-color-accent-dark);
    color: var(--lexxy-color-ink-inverted);

    &:hover {
      background-color: var(--lexxy-color-accent-medium);
    }
  }
}

/* Color dropdown
/* -------------------------------------------------------------------------- */

:where(lexxy-highlight-dropdown) {
  display: flex;
  flex-direction: column;

  [data-button-group] {
    display: flex;
    justify-items: flex-start;
    flex-direction: row;
    gap: var(--dropdown-gap);

    button {
      aspect-ratio: 1 / 1;
      inline-size: var(--button-size);
      min-inline-size: var(--button-size);
      max-inline-size: var(--button-size);

      &:after {
        align-self: center;
        content: "Aa";
        display: inline-block;
        font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        position: absolute;
        inset-block-start: 0;
        inset-block-end: 0;
        inset-inline-end: 0;
        inset-inline-start: 0;
      }
    }
  }

  button {
    --button-size: 2lh;

    color: var(--lexxy-color-text);
    flex: 1;
    min-block-size: var(--button-size);
    position: relative;
    font: initial;

    &:hover {
      opacity: 0.8;
    }

    &[aria-pressed="true"] {
      box-shadow: 0 0 0 2px currentColor inset;

      &:after {
        content: "✓";
      }
    }
  }

  .lexxy-editor__toolbar-dropdown-reset[disabled] {
    display: none;
  }
  
  [overflowing] & {
    inline-size: fit-content;

    [data-button-group] {
      flex-wrap: wrap;

      button {
        --button-size: 1.6lh;

        &:after {
          font-size: 0.9em;
        }
      }
    }
  }
}

/* Table dropdown
/* -------------------------------------------------------------------------- */

:where(lexxy-table-dropdown) {
  display: flex;
  flex-direction: column;
  gap: 1ch;
  
  .lexxy-editor__table-create {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0;

    .lexxy-editor__table-buttons {
      background-color: var(--lexxy-color-ink-lighter);
      display: flex;
      flex-direction: column;
      gap: 1px;
      padding: 1px;

      div {
        display: flex;
        flex-direction: row;
        gap: 1px;
      }

      button {
        aspect-ratio: 1.5 / 1;
        border: 0;
        border-radius: 0;
        color: var(--lexxy-color-ink);
        font-family: var(--lexxy-font-base);
        font-size: var(--lexxy-text-small);
        font-weight: normal;
        inline-size: 4ch;
        margin: 0;

        &.active {
          background-color: var(--lexxy-color-ink-lightest);
        }
      }
    }

    label {
      align-items: center;
      display: flex;
      gap: 0.5ch;
      padding: 0.5ch 0;
      margin-block-start: 1ch;
    }

    &:has(input[type="checkbox"]:checked) {
      .lexxy-editor__table-buttons {
        div:first-child button,
        button:first-child {
          filter: brightness(0.95);
        }
      }
    }
  }

  .lexxy-editor__table-edit {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0;

    button {

    }
  }
}

/* Table handle buttons
/* -------------------------------------------------------------------------- */

:where(.lexxy-table-handle-buttons) {
  --button-size: 2.5lh;
  color: var(--lexxy-color-ink-inverted);
  display: none;
  flex-direction: row;
  font-size: var(--lexxy-text-small);
  gap: 0.25ch;
  line-height: 1;
  position: absolute;
  transform: translate(-50%, -120%);
  z-index: 10;

  .lexxy-table-control {
    align-items: center;
    background-color: var(--lexxy-color-ink);
    border-radius: 0.75ch;
    display: flex;
    flex-direction: row;
    gap: 1ch;
    padding: 2px;
    white-space: nowrap;

    button {
      aspect-ratio: 1 / 1;
      align-items: center;
      background-color: transparent;
      border-radius: var(--lexxy-radius);
      border: 0;
      color: var(--lexxy-color-ink-inverted);
      cursor: pointer;
      display: flex;
      font-weight: bold;
      justify-content: center;
      line-height: 1;
      min-block-size: var(--button-size);
      min-inline-size: var(--button-size);
      padding: 0;

      &:hover,
      &:focus-visible {
        background-color: var(--lexxy-color-ink-medium);
      }

      svg {
        block-size: 1em;
        inline-size: 1em;
        fill: currentColor;
      }

      span {
        display: none;
      }
    }
  }

  .lexxy-table-control__more-menu {
    gap: 0;
    padding: 2px;
    position: relative;
    
    summary {
      aspect-ratio: 1 / 1;
      align-items: center;
      background: transparent;
      border-radius: var(--lexxy-radius);
      border: 0;
      box-sizing: border-box;
      display: flex;
      font-size: inherit;
      justify-content: center;
      list-style: none;
      min-block-size: var(--button-size);
      min-inline-size: var(--button-size);
      padding: 0;
      user-select: none;
      -webkit-user-select: none;

      &::-webkit-details-marker {
        display: none;
      }

      &:hover {
        background: var(--lexxy-color-ink-medium);
      }
    }

    .lexxy-table-control__more-menu-details {
      display: flex;
      flex-direction: column;
      gap: 0.25ch;
      inset-block-start: 105%;
      inset-inline-start: 0;
      padding: 0;
      position: absolute;

      .lexxy-table-control__more-menu-section {
        background: var(--lexxy-color-ink);
        border-radius: 0.75ch;
        display: flex;
        flex-direction: column;
        padding: 2px;
      }

      button {
        aspect-ratio: unset;
        align-items: center;
        display: flex;
        flex-direction: row;
        font-weight: normal;
        gap: 1ch;
        justify-content: flex-start;
        padding: 0.5ch 2ch;
        padding-inline-start: 1ch;
        white-space: nowrap;

        span {
          display: inline-block;
        }

        svg {
          block-size: 1.3lh;
          inline-size: 1.3lh;
          fill: currentColor;
        }
      }
    }
  }
}


/* Language picker
/* -------------------------------------------------------------------------- */

:where(.lexxy-code-language-picker) {
  max-width: fit-content;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--lexxy-color-canvas);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23000'/%3E%3C/svg%3E");
  background-position: center right 1ch;
  background-repeat: no-repeat;
  background-size: 1ch;
  block-size: 1.5lh;
  border: 1px solid var(--lexxy-color-ink-lighter);
  border-radius: var(--lexxy-radius);
  color: var(--lexxy-color-ink);
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  font-weight: normal;
  inset-inline-end: var(--lexxy-editor-padding);
  margin: 0;
  padding: 0 2ch 0 1ch;
  text-align: start;

  @media (prefers-color-scheme: dark) {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12 19.5c-.7 0-1.3-.3-1.7-.8l-9.8-11.1c-.7-.8-.6-1.9.2-2.6.8-.6 1.9-.6 2.5.2l8.6 9.8c0 .1.2.1.4 0l8.6-9.8c.7-.8 1.8-.9 2.6-.2s.9 1.8.2 2.6l-9.8 11.1c-.4.5-1.1.8-1.7.8z' fill='%23fff'/%3E%3C/svg%3E");
  }
}

/* Prompt
/* ------------------------------------------------------------------------ */

:where(.lexxy-prompt-menu) {
  --lexxy-prompt-avatar-size: 24px;
  --lexxy-prompt-min-width: 20ch;
  --lexxy-prompt-padding: 0.5ch;

  background-color: var(--lexxy-color-canvas);
  border-radius: calc(var(--lexxy-prompt-padding) * 2);
  box-shadow: var(--lexxy-shadow);
  color: var(--lexxy-color-ink);
  font-family: var(--lexxy-font-base);
  font-size: var(--lexxy-text-small);
  list-style: none;
  margin: 0;
  max-block-size: 200px;
  min-inline-size: var(--lexxy-prompt-min-width);
  overflow: auto;
  padding: var(--lexxy-prompt-padding);
  visibility: hidden;
  z-index: var(--lexxy-z-popup);
}

:where(.lexxy-prompt-menu--visible) {
  visibility: initial;
}

:where(.lexxy-prompt-menu__item) {
  align-items: center;
  border-radius: var(--lexxy-radius);
  cursor: pointer;
  display: flex;
  gap: var(--lexxy-prompt-padding);
  padding: var(--lexxy-prompt-padding);
  white-space: nowrap;

  &:hover {
    background-color: var(--lexxy-color-ink-lightest);
  }

  &[aria-selected] {
    background-color: var(--lexxy-color-selected);
  }

  img {
    block-size: var(--lexxy-prompt-avatar-size);
    border-radius: 50%;
    flex-shrink: 0;
    inline-size: var(--lexxy-prompt-avatar-size);
    margin: 0;
  }

  + & {
    margin-top: 2px;
  }
}

:where(.lexxy-prompt-menu__item--empty) {
  color: var(--lexxy-color-ink-medium);
  padding: var(--lexxy-prompt-padding);
}

/* Markdown editor styles */
.markdown-editor .editor-pane textarea {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Rouge syntax highlighting - GitHub theme (light/dark mode support) */
.highlight {
  background: #f6f8fa;
  border-radius: 0.375rem;
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid #d0d7de;
}

.highlight code {
  color: #24292f;
  font-size: 0.875rem;
  line-height: 1.5;
}

.dark .highlight {
  background: #161b22;
  border-color: #30363d;
}

.dark .highlight code {
  color: #c9d1d9;
}

/* Light mode syntax colors (GitHub Light) */
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs { color: #6e7781; font-style: italic; } /* Comment */
.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt { color: #cf222e; } /* Keyword */
.highlight .s,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr,
.highlight .s1 { color: #0a3069; } /* String */
.highlight .na { color: #116329; } /* Name.Attribute */
.highlight .nb { color: #953800; } /* Name.Builtin */
.highlight .nc { color: #953800; } /* Name.Class */
.highlight .no { color: #0550ae; } /* Name.Constant */
.highlight .nd { color: #8250df; } /* Name.Decorator */
.highlight .ni { color: #24292f; } /* Name.Entity */
.highlight .ne { color: #953800; } /* Name.Exception */
.highlight .nf { color: #8250df; } /* Name.Function */
.highlight .nl { color: #0550ae; } /* Name.Label */
.highlight .nn { color: #953800; } /* Name.Namespace */
.highlight .nt { color: #116329; } /* Name.Tag */
.highlight .nv { color: #0550ae; } /* Name.Variable */
.highlight .o,
.highlight .ow { color: #cf222e; } /* Operator */
.highlight .m,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il { color: #0550ae; } /* Number */
.highlight .p { color: #24292f; } /* Punctuation */
.highlight .bp { color: #0550ae; } /* Name.Builtin.Pseudo */
.highlight .fm { color: #8250df; } /* Name.Function.Magic */
.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .vm { color: #0550ae; } /* Name.Variable.* */
.highlight .err { color: #cf222e; } /* Error */

/* Dark mode syntax colors (GitHub Dark) */
.dark .highlight .c,
.dark .highlight .cm,
.dark .highlight .c1,
.dark .highlight .cs { color: #8b949e; font-style: italic; }
.dark .highlight .k,
.dark .highlight .kc,
.dark .highlight .kd,
.dark .highlight .kn,
.dark .highlight .kp,
.dark .highlight .kr,
.dark .highlight .kt { color: #ff7b72; }
.dark .highlight .s,
.dark .highlight .sb,
.dark .highlight .sc,
.dark .highlight .sd,
.dark .highlight .s2,
.dark .highlight .se,
.dark .highlight .sh,
.dark .highlight .si,
.dark .highlight .sx,
.dark .highlight .sr,
.dark .highlight .s1 { color: #a5d6ff; }
.dark .highlight .na { color: #7ee787; }
.dark .highlight .nb { color: #ffa657; }
.dark .highlight .nc { color: #ffa657; }
.dark .highlight .no { color: #79c0ff; }
.dark .highlight .nd { color: #d2a8ff; }
.dark .highlight .ni { color: #c9d1d9; }
.dark .highlight .ne { color: #ffa657; }
.dark .highlight .nf { color: #d2a8ff; }
.dark .highlight .nl { color: #79c0ff; }
.dark .highlight .nn { color: #ffa657; }
.dark .highlight .nt { color: #7ee787; }
.dark .highlight .nv { color: #79c0ff; }
.dark .highlight .o,
.dark .highlight .ow { color: #ff7b72; }
.dark .highlight .m,
.dark .highlight .mf,
.dark .highlight .mh,
.dark .highlight .mi,
.dark .highlight .mo,
.dark .highlight .il { color: #79c0ff; }
.dark .highlight .p { color: #c9d1d9; }
.dark .highlight .bp { color: #79c0ff; }
.dark .highlight .fm { color: #d2a8ff; }
.dark .highlight .vc,
.dark .highlight .vg,
.dark .highlight .vi,
.dark .highlight .vm { color: #79c0ff; }
.dark .highlight .err { color: #f85149; }

/* Task list styling (light/dark mode support) */
.task-list-item {
  list-style-type: none;
  margin-left: -1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.task-list-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.25rem;
  border: 1.5px solid #d0d7de;
  border-radius: 0.25rem;
  background-color: #ffffff;
  cursor: not-allowed;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.task-list-item input[type="checkbox"]:checked {
  background-color: #0969da;
  border-color: #0969da;
  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: 100%;
  background-position: center;
  background-repeat: no-repeat;
}

/* Dark mode task list */
.dark .task-list-item input[type="checkbox"] {
  border-color: #30363d;
  background-color: #0d1117;
}

.dark .task-list-item input[type="checkbox"]:checked {
  background-color: #238636;
  border-color: #238636;
}

/* Mermaid diagram styling (matches code block styling) */
.mermaid {
  background: #ffffff;
  border-radius: 0.375rem;
  overflow-x: auto;
  padding: 1.5rem;
  border: 1px solid #d0d7de;
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.mermaid svg {
  max-width: 100%;
  height: auto;
}

.dark .mermaid {
  background: #0d1117;
  border-color: #30363d;
}
.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.
 *


 */
 

:root {
  color-scheme: light;
  --header-height: 65px; /* Adjust based on your actual header height */
  --filters-height: 68px; /* Adjust based on your actual filters height */
  --subheader-height: 161px; /* Adjust based on your actual subheader height */
}

button {
  &:hover {
    cursor: pointer;
  }
}

.dark {
  color-scheme: dark;
}


/* Scrollbar styling with dark/light mode support */
:root {
  /* Light mode variables */
  --scrollbar-thumb-light: rgba(0, 0, 0, 0.3);
  --scrollbar-thumb-hover-light: rgba(0, 0, 0, 0.5);
  --scrollbar-track-light: transparent;

  /* Dark mode variables */
  --scrollbar-thumb-dark: rgba(255, 255, 255, 0.3);
  --scrollbar-thumb-hover-dark: rgba(255, 255, 255, 0.5);
  --scrollbar-track-dark: transparent;
}

/* Default scrollbar (light mode) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track-light);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-light);
  border-radius: 5px;
}

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

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
  background: var(--scrollbar-track-dark);
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-dark);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover-dark);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-light) var(--scrollbar-track-light);
}

.dark * {
  scrollbar-color: var(--scrollbar-thumb-dark) var(--scrollbar-track-dark);
}

input {
  color-scheme: light;
}

.dark input {
  color-scheme: dark;
}

@keyframes slideInFromLeft {
  0% {
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
  }
  100% {
    transform: scaleX(1);
    transform-origin: left;
    opacity: 1;
  }
}
