/* @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap'); */

* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  font-size: 15px;
  box-sizing: border-box;
  font-family: var(--font-stack-sans-serif);
  color: var(--color-text);
  line-height: 1.5;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  background-color: var(--color-bg);
}

html > body.development {
  /* border: 4px dashed orange; */
}

main {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  overflow: hidden;
  overflow: auto;
  min-height: 0;
  padding: calc(var(--base-spacing) * 2);

  &.compact {
    width: 100%;
    max-width: 960px;
    margin: 0 auto; 
  }
}

p {
  margin-bottom: var(--base-spacing);
  word-break: break-word;
}

a {
  cursor: pointer;
  color: black;
}

main,
footer,
header,
nav {
  padding: 0 var(--base-spacing);
  max-width: 100%;
}

.profile-icon {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: #ccc;
  &.is-large {
    width: 48px;
    height: 48px;
  }
}

#main-nav {
  width: 100%;
  min-width: 100%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  background-color: var(--header-bg);
  overflow-x: auto;
  min-height: 51px;
  button {
    border-radius: 0;
  }
  a > .button-count {
    position: absolute;
    top: 1px;
    right: -5px;
  }
  section {
    display: flex;
    align-items: center;
    margin: 0 auto;
    height: 50px;
    width: 100%;
  }
  .logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    user-select: none;
    &:hover {
      background-color: transparent;
    }
  }
  .logo-40 {
    background-color: transparent;
  }
  a {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    line-height: 45px;
    color: var(--color-text);
    height: 100%;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    padding: 0 1rem;
    margin-right: calc(var(--base-spacing)/4);
    line-height: 1;
    white-space: nowrap;

    i + span{
      margin-left: calc(var(--base-spacing)/2);
    }
    &:hover {
      background: rgba(0, 0, 0, 0.05);
    }
    &.selected {
      border-bottom: 2px solid black;
    }
  }
}


footer {
  padding: calc(var(--base-spacing)) var(--base-spacing) !important;
}

.field {
  margin-bottom: calc(var(--base-spacing) * 2);

  &:last-of-type {
    margin-bottom: 0;
  }

  label { cursor: pointer; margin: 0; }

  .field_with_errors {
    label { color: var(--color-red); }
    input { border-color: var(--color-red); }
  }

  .hint, .helper-text { display: block; }

  &.horizontal {
    display: flex;
    align-items: center;
    label { margin-right: calc(var(--base-spacing) / 2); }
  }

  i {
    height: 1rem;
    line-height: 1rem;
  }
}
label[required]:after{content:"*"}


.field textarea,
.field select,
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field input[type=url],
.field input[type=tel],
.field input[type=date],
.field input[type=datetime-local],
.field input[type=time] {
  margin: 0.25rem 0;
  width: 100%;
}
.field input[type=checkbox],
.field input[type=radio] {
  margin-right: 0.5rem;
}

.field.field_with_errors {
  input {
    border-color: var(--color-red);
  }
}

input[type=checkbox],
input[type=radio] {
  width: auto;
  width: 25px !important;
  min-width: 25px !important;
}

.box {
  position: relative;
  background-color: var(--color-box);
  color: var(--color-text);
  padding: calc(var(--base-spacing) * 2) calc(var(--base-spacing) * 3);
  border-radius: var(--box-radius);
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--color-border);
  display: inline-block;

  p:first-child,
  h1:first-child,
  h2:first-child,
  h3:first-child,
  h4:first-child,
  h5:first-child,
  h6:first-child {
    margin-top: 0;
  }

  p:last-child {
    margin-bottom: 0 !important;
  }

  &:empty {
    display: none;
  }

  &.is-narrow {
    padding: var(--base-spacing) calc(var(--base-spacing) * 1);
  }

  &.is-super-narrow {
    padding: var(--base-spacing) calc(var(--base-spacing) * 1);
  }

  &.is-paddingless {
    padding: 0;
  }

  &.is-danger {
    background-color: #fde6dc;
    border-color: #efd5c9;
  }

  &.is-warning {
    background-color: #fff8e1;
    border-color: #ffe9a8;
  }

  &.is-notice {
    background-color: #fffced !important;
    border-color: #e1dcc3 !important;
    @media (prefers-color-scheme: dark) {
      background-color: #5e5d4d;
      border-color: #3f3f35;
      color: rgba(0, 0, 0, 0.9);
    }
  }

  &.is-bg-trans {
    background-color: transparent;
    box-shadow: none;
  }
}

input {
  border-radius: var(--form-radius);
}

.input,
textarea,
input[type=tel],
input[type=time],
input[type=date],
input[type=datetime-local],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
input[type=submit],
input[type=text] {
  display: block;
  box-shadow: inset 0 0.0625em 0.125em rgba(10, 10, 10, 0.05);
  max-width: 100%;
  -webkit-appearance: none;
  align-items: center;
  border: 1px solid var(--color-border);
  font-size: 1rem;
  height: 2.5em;
  justify-content: flex-start;
  line-height: 1.25;
  padding-bottom: calc(0.5em - 1px);
  padding-left: calc(0.75em - 1px);
  padding-right: calc(0.75em - 1px);
  padding-top: calc(0.5em - 1px);
  position: relative;
  background-color: var(--input-bg);

  &:focus {
    outline: 1px solid var(--color-border-hover);
  }

  &.is-title {
    box-shadow: none;
    font-weight: 600;
    font-size: 3rem;
    border: 1px solid transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    padding: 0 var(--base-spacing);
    background-color: transparent;
    margin: 0;
    line-height: 1;
    height: 4.5rem;
    outline: none;
    &:hover,
    &:focus {
      outline: none;
      border-color: transparent;
      border: 1px solid transparent;
      border-bottom: 1px solid rgba(0, 0, 0, 1);
    }
  }
}

.input.is-invalid,
textarea.is-invalid,
input[type=tel].is-invalid,
input[type=time].is-invalid,
input[type=date].is-invalid,
input[type=datetime-local].is-invalid,
input[type=email].is-invalid,
input[type=password].is-invalid,
input[type=number].is-invalid,
input[type=submit].is-invalid,
input[type=text].is-invalid {
  border-color: var(--color-danger);
}

.input.is-invalid:hover,
textarea.is-invalid:hover,
input[type=tel].is-invalid:hover,
input[type=time].is-invalid:hover,
input[type=date].is-invalid:hover,
input[type=datetime-local].is-invalid:hover,
input[type=email].is-invalid:hover,
input[type=password].is-invalid:hover,
input[type=number].is-invalid:hover,
input[type=submit].is-invalid:hover,
input[type=text].is-invalid:hover {
  border: 1px solid var(--color-red);
}

.input:hover,
textarea:hover,
input[type=tel]:hover,
input[type=time]:hover,
input[type=date]:hover,
input[type=datetime-local]:hover,
input[type=email]:hover,
input[type=password]:hover,
input[type=number]:hover,
input[type=submit]:hover,
input[type=text]:hover {
  border: 1px solid rgba(0, 0, 0, 0.2);
}

input[type=time],
input[type=date],
input[type=datetime-local] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--input-bg);
  color: var(--color-text);
  cursor: pointer;
  font-family: var(--font-stack-sans-serif);
  padding: 0.5rem 1rem;
  height: auto;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
  input[type=time],
  input[type=date],
  input[type=datetime-local] {
    background-color: #2c2c2c;
    color: white;
    border: 1px solid #666;
  }
}

input[type=time]:hover,
input[type=date]:hover,
input[type=datetime-local]:hover {
  filter: brightness(1.2);
}


input[type=submit],
button,
.button {
  position: relative;
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--button-radius);
  background-color: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-text);
  justify-content: center;
  padding: 0.5rem 1rem;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  min-height: 2.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-touch-callout: none;
  -webkit-user-select: none;

  &:hover,
  &:focus {
    background-color: var(--button-bg-hover);
    border-color: var(--button-border-hover);
  }
}

/* Primary Button Variation */
button.is-primary,
.button.is-primary {
  background-color: var(--button-primary-bg);
  color: var(--button-primary-text);
  border-color: var(--button-primary-border);

  &:hover,
  &:focus {
    background-color: var(--button-primary-hover);
    border-color: var(--button-primary-border);
  }
}

.button-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #bd841b;
  border-radius: 100%;
  width: 20px;
  height: 20px;
  text-align: center;
  line-height: 20px;
  color: white;
  font-size: 10px;
  font-weight: 500;
}

button a,
.button a {
  text-decoration: none;
}

button[disabled],
.button[disabled],
button.disabled,
.button.disabled {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.5;
}

button.is-small,
.button.is-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  min-height: 2rem;

  &.is-tokens {
    padding: 0;
    .value {
      padding: 0.4rem 0.8rem;
    }
    .amount {
      padding: 0.4rem 0.8rem;
    }
  }
}

.button.is-large {
  padding: 1rem 2rem;
  font-size: 1.4rem;
}

.button.is-borderless {
  background-color: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  &:hover {
    border: 1px solid rgba(0, 0, 0, 0.1);
  }
}

button.is-tiny,
.button.is-tiny {
  padding: 0.2rem 0.4rem;
  font-size: 0.6rem;
  line-height: 1;
  min-height: 1.5rem;
}

button.is-link,
.button.is-link {
  border-color: transparent;
  font-weight: 500;
  text-decoration: underline;
  color: rgba(0, 0, 0, 0.85);
  background-color: transparent;
  box-shadow: none;
  &:hover,
  &:focus {
    color: black;
    background-color: transparent;
    box-shadow: none;
  }
}

button.is-link:hover,
.button.is-link:hover {
  color: black;
  border-color: transparent;
}

button.is-danger,
.button.is-danger {
  background-color: var(--color-danger);
  border-color: var(--color-danger);
  color: white;

  &:hover {
    filter: brightness(1.1);
    background-color: var(--color-danger);
    border-color: var(--color-danger);
  }
}

button.is-success,
.button.is-success {
  background-color: var(--color-success) !important;
  border-color: var(--color-success) !important;
  color: white !important;

  &:hover {
    filter: brightness(1.1);
    background-color: var(--color-success) !important;
    border-color: var(--color-success) !important;
  }
}

button.is-error,
.button.is-error {
  background-color: var(--color-danger) !important;
  border-color: var(--color-danger) !important;
  color: white !important;

  &:hover {
    filter: brightness(1.1);
    background-color: var(--color-danger) !important;
    border-color: var(--color-danger) !important;
  }
}

.button-group {
  display: inline-flex;
}

.button-group .button {
  border-radius: 0;
  border-color: rgba(0, 0, 0, 0.6);
  margin: 0;
}

.button-group .button:first-child {
  border-radius: var(--button-radius) 0 0 var(--button-radius);
}

.button-group .button:last-child {
  border-radius: 0 var(--button-radius) var(--button-radius) 0;
}

.button-group .button:not(:last-child) {
  border-right: none;
}

.button-group .button:hover {
  border-color: rgba(0, 0, 0, 0.2);
  z-index: 1;
}


table {
  border-collapse: collapse;
  cursor: default;
  width: 100%;
  background-color: var(--color-bg);
  
  &.has-border {
    border: 1px solid var(--color-border);
    border-radius: var(--form-radius);

    thead {
      border-bottom: 1px solid var(--color-border);
    }
  }
  
  tr:nth-child(even) {
    background-color: var(--table-td-even-bg);
  }
  
  tr:nth-child(odd) {
    background-color: var(--table-td-odd-bg);
  }

  &.is-drafts {
    th { background-color: var(--table-td-drafts-bg) !important; }
  }
}

thead {
  background: var(--table-thead-bg);
}

table th,
table td {
  text-align: left;
  padding: calc(var(--base-spacing));
  background-color: inherit;
}

table th:last-child,
table td:last-child {
  width: auto;
}

table td {
  padding: calc(var(--base-spacing) / 2) var(--base-spacing);
}

.helper-text,
.hint {
  color: var(--color-text-muted);
  font-family: var(--font-stack-sans-serif);
  font-size: 0.9rem;
  line-height: 1.5;
  display: inline-block;
  opacity: 0.8;
}

hr {
  border-top: 1px solid var(--color-border);
  border-bottom: none;
}

.tag {
  border: 1px solid transparent;
  font-size: 0.6rem;
  background: black;
  color: white;
  display: inline-block;
  padding: 0.2rem 0.4rem;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.5px;
  border-radius: calc(var(--form-radius) / 2);
  font-family: var(--font-stack-sans-serif);
  font-family: var(--font-stack-monospace);
  cursor: default;

  &.is-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
  }

  &.is-draft {
    background-color: #525c57;
    border-color: #525c57;
  }

  &.is-type {
    background-color: transparent;
    border: 0;
    color: #525c57;
    border-bottom: 2px solid #525c57;
  }

  &.is-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
  }
}

summary {
  cursor: pointer;
}

legend,
.legend,
label,
.label {
  display: block;
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  text-transform: capitalize;
}

/* Hide the built-in marker for full control */
summary {
  list-style: none;
  cursor: pointer;
}
summary::-webkit-details-marker {
  display: none;
}

/* Add custom marker with full control over spacing */
summary::before {
  content: "▸";
  display: inline-block;
  width: 1rem;
  line-height: 1;
  color: rgba(0, 0, 0, 0.6);
  margin-right: calc(var(--base-spacing) / 1.5);
  opacity: 0.4;
  transition: transform 0.2s ease;
  transform-origin: 50% 50%;
  vertical-align: middle;
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 0.3rem;
  transform: rotate(0deg);
  flex-shrink: 0;
}

/* Rotate marker when details are open */
details[open] summary::before {
  transform: rotate(90deg);
}

/* For flex container summaries, ensure closed state is explicit */
summary.flex::before {
  transform: rotate(0deg);
  align-self: flex-start;
}

details[open] summary.flex::before {
  transform: rotate(90deg);
}

th {
  font-weight: 500;
  letter-spacing: 0.5px;
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
  /* font-family: var(--font-stack-sans-serif); */
  font-family: var(--font-stack-monospace);
  white-space: nowrap;
  @media (prefers-color-scheme: dark) {
    color: rgba(255, 255, 255, 0.7);
  }
}

.modal-overlay {
  cursor: pointer;
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal {
  position: fixed;
  z-index: 9000;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  max-width: 90vw;
  max-height: calc(90vh - 64px);
  overflow: auto;
}

/* Print styles for modal */
/* No box shadow or modal for QR code modal printing */
@media print {
  .modal {
    box-shadow: none !important;
    border: none !important;
  }
  .modal-overlay {
    background: white !important;
  }
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1;
  font-weight: 600;
}

h1 {
  letter-spacing: -1px;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem !important;
  }
}


@media (prefers-color-scheme: dark) {
  body {
    background-color: #333;
    color: #fff;
  }

  #main-nav {
    a {
      color: rgba(255, 255, 255, 0.85);
    }
  }

  .notice {
    color: rgba(0, 0, 0, 0.7);
  }

  .box {
    background-color: #444;
    color: white;

    &.notice {
      color: black;
    }

    &.is-red,
    &.is-danger {
      background-color: #3a1c1c;
      border-color: #62312f;
    }
  }

  h1, h2, h3, h4, h5, h6 {
    color: white;
  }

  a {
    color: white;
  }

  label, legend {
    color: rgba(255, 255, 255, 0.5);
  }

  .button {
    background: #2c2c2c;
    color: white;

    &:hover,
    &:focus {
      background-color: #444444;
    }

    &.is-primary {
      background: var(--button-primary-bg);
      background-color: var(--button-primary-bg);
      border-color: var(--button-primary-border);
      color: var(--button-primary-text);

      i,
      svg {
        color: inherit;
        fill: currentColor;
      }

      &:hover,
      &:focus {
        background: var(--button-primary-hover);
        background-color: var(--button-primary-hover);
        color: white;
      }
    }

    &.is-success {
      background-color: #44654a !important;
      border-color: #44654a !important;
    }

    &.is-error,
    &.is-danger {
      background-color: #a43b3b;
      border-color: #a43b3b;
    }

    &.is-link {
      background: transparent;
      color: white;

      &:focus,
      &:hover {
        color: white;
      }
    }
  }


  input, textarea, select {
    background-color: #2c2c2c;
    color: white;
    border: 1px solid #666;
  }

  .sticky-character-footer {
    background-color: #333;
    color: white;
    border-color: #555;
  }

  .action-footer {
    background-color: #333;
    color: white;
    border-color: #555;
  }

  legend,
  .legend,
  label,
  .label {
    color: white;
  }
}



.pagination {
  font-family: var(--font-stack-sans-serif);
  .disabled { opacity: 0.5; pointer-events: none; }
  a, em {
    padding: 0 calc(var(--base-spacing)/4);
  }
  em.current {
    font-style: normal;
    opacity: 0.6;
    pointer-events: none;
  }
  margin-top: calc(var(--base-spacing) / 4);
  margin-bottom: calc(var(--base-spacing) / 2);
}

input[type=file]:hover {
  filter: brightness(1.2);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  input[type=file] {
    background-color: transparent;
    color: white;
    border: none;
  }
}


/* Style the "Choose File" button inside file inputs */
input[type=file]::-webkit-file-upload-button,
input[type=file]::file-selector-button {
  font-weight: 500;
  font-family: var(--font-stack-sans-serif);
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--button-radius);
  background-color: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
  background: var(--color-primary);
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  margin-inline-end: 1rem;
  color: white;
}

/* Hover state */
input[type=file]::-webkit-file-upload-button:hover,
input[type=file]::file-selector-button:hover {
  filter: brightness(1.2);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  input[type=file]::-webkit-file-upload-button,
  input[type=file]::file-selector-button {
    background-color: #555;
    color: white;
    border: 1px solid #666;
  }
}

.flashes {
  cursor: pointer;
  z-index: 9999;
  animation: flashes 5.5s forwards;
  background-color: white;
  position: fixed;
  top: calc(var(--base-spacing) * 2);
  right: calc(var(--base-spacing) * 2);
  padding: 1rem;
}

@media (prefers-color-scheme: dark) {
  .flashes {
    background-color: #444;
  }
}

/* Flashes shake and fade out */
@keyframes flashes {
  0% { transform: translateX(10px); opacity: 1; display: none; }
  1% { transform: translateX(-10px); opacity: 1; display: block; }
  2% { transform: translateX(10px); opacity: 1; display: block; }
  3% { transform: translateX(-10px); opacity: 1; display: block; }
  4% { transform: translateX(0); opacity: 1; display: block; }
  5% { transform: translateX(-10px); opacity: 1; display: block; }
  6% { transform: translateX(0); opacity: 1; display: block; }
  80% { transform: translateX(0); opacity: 1; display: block; }
  100% { transform: translateX(0); opacity: 0; display: none; }
}


:root {
  --blob-blur: 4px;
}

.blob-container {
  width: 120px;
  height: 120px;
  position: relative;
  animation: float 7s ease-in-out infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  
  /* &::before { */
    /* content: ''; */
    /* position: absolute; */
    /* width: 100%; */
    /* height: 100%; */
    /* background: rgba(0, 0, 0, 0.3); */
    /* background: transparent; */
    /* padding: 4px; */
    /* box-sizing: border-box; */
    /* clip-path: polygon(50% 0%, 92% 50%, 50% 100%, 8% 50%); */
    /* -webkit-clip-path: polygon(50% 0%, 92% 50%, 50% 100%, 8% 50%); */
  /* } */

  &.active {
    animation: float 5s ease-in-out infinite;
  }
}

.logo {
  font-size: 2rem;
  color: rgba(0, 0, 0, 0.9);

  @media (prefers-color-scheme: dark) {
    color: rgba(255, 255, 255, 0.3);
  }
}


.blob {
  position: absolute;
  transition: all 0.3s;
  &:after {
    transition: all 0.9s;
    content: "♦";
    font-size: 100px;
    color: rgba(0, 0, 0, 0.1);
  }

  &:nth-child(1) { 
    animation: blob-float 3s ease-in-out infinite;
    animation-delay: -2s;
    filter: blur(0) !important;
    animation: none;
    &:hover {
      filter: blur(1px);
      &:after {
        color: rgba(0, 0, 0, 0.25);
      }
    }
  }
  &:nth-child(2) { 
    pointer-events: none;
    animation: blob-float 5s ease-in-out infinite;
    animation-delay: 5s;
    filter: blur(3px) !important;
  }
  &:nth-child(3) { 
    pointer-events: none;
    animation: blob-float 6s ease-in-out infinite;
    animation-delay: 1s;
    filter: blur(3px) !important;
  }
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, 30%); }
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -3%); }
}
@keyframes float-big {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, -10%); }
}

.float {
  animation: float 5s ease-in-out infinite;
}
.float-big {
  animation: float-big 5s ease-in-out infinite;
}


.chat-bubble {
  position: relative;
  background: var(--color-box);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  border: 1px solid var(--color-border);
  margin: 20px 0;
  animation: fade-in 0.2s ease-in-out forwards;
  cursor: default;

  &.with-tail:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 10%;
    margin-left: -7px;
    border-width: 7px;
    border-style: solid;
    border-color: var(--color-box) transparent transparent transparent;
    filter: drop-shadow(0px 1px 0px var(--color-border));
    transition: opacity 0.3s;
    z-index: 1;
  }

  textarea {
    width: 100%;
    min-height: 2rem;
    border: none;
    resize: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1.5;
    outline: none;
    padding: 0;
    box-shadow: none;
    height: 100px;
    
    &:focus {
      outline: none;
      box-shadow: none;
    }
  }

  p:first-of-type {
    margin-top: 0;
  }
  p:last-of-type {
    margin-bottom: 0;
  }

  &.is-obelisk:before {
    content: '♦';
    font-size: 2rem;
    position: absolute;
    top: -12px;
    left: -12px;
    background: var(--color-box);
    border: 1px solid var(--color-border);
    border-radius: 100%;
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

    /* Dark mode support */
    @media (prefers-color-scheme: dark) {
      background: #444;
      color: var(--color-text-muted);
    }
  }
}

.meta-forms .chat-bubble {
  animation: none;
}


.is-glowing {
  animation: shift-shadow 22s ease-in-out infinite;
}

.action-history {
  background: rgba(0, 0, 0, 0.05);
  font-family: var(--font-stack-monospace);
  padding: calc(var(--base-spacing) / 2) var(--base-spacing);
  border-left: 2px solid rgba(0, 0, 0, 0.1);
  font-size: 14px;
  line-height: 1.2;
  color: rgba(0, 0, 0, 0.6);
  letter-spacing: 0.02em;
  cursor: default;
  transition: all 0.1s ease-in-out;
  &:hover {
    border-left: 2px solid rgba(0, 0, 0, 0.2);
  }

  /* Dark mode support */
  @media (prefers-color-scheme: dark) {
    background: #444;
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes shift-shadow {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(255, 0, 128, 0.2); /* #ff0080 */
  }
  25% { 
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2); /* #ff8c00 */
  }
  50% { 
    box-shadow: 0 2px 8px rgba(64, 224, 208, 0.2); /* #40e0d0 */
  }
  75% { 
    box-shadow: 0 2px 8px rgba(123, 104, 238, 0.2); /* #7b68ee */
  }
}

@media (prefers-color-scheme: dark) {
  .chat-bubble {
    background: #444;
    border-color: #555;
  }
}

/* Fixed header table styles */
.table-fixed-header {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--form-radius);
  min-height: 0;
  
  /* Fix header */
  thead {
    position: sticky;
    top: 0;
    z-index: 2;
  }
  
  /* Ensure proper border rendering with sticky header */
  thead::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-bottom: 1px solid var(--color-border);
  }

  /* Fix first column */
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
  }

  /* Match the alternating row pattern for first column */
  tr td:first-child {
    background-color: var(--table-td-even-bg);
  }

  tr:nth-child(even) td:first-child {
    background-color: var(--table-td-odd-bg);
  }

  /* Update background on hover for first column */
  tr:hover td {
    background-color: var(--table-td-hover-bg) !important;
  }

  /* Fix header corner */
  thead th:first-child {
    z-index: 1;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--color-border);
  }

  thead th:not(:first-child) {
    background-color: var(--header-bg);
  }

  /* Add shadow to fixed column */
  th:first-child::after,
  td:first-child::after {
    content: '';
    position: absolute;
    top: 0;
    right: -4px;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.05), transparent);
    pointer-events: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .table-fixed-header {
    thead {
      background: var(--table-thead-bg);
    }

    thead th:first-child {
      background-color: var(--table-thead-bg);
    }

    th:first-child::after,
    td:first-child::after {
      background: linear-gradient(to right, rgba(255, 255, 255, 0.05), transparent);
    }
  }
}


.tooltip {
  cursor: help;
}

.tooltip-text {
  pointer-events: none;
  position: fixed;
  max-width: 350px;
  color: var(--tooltip-text);
  background-color: var(--tooltip-bg);
  text-align: left;
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 99999;
  font-family: var(--font-stack-monospace);
  font-weight: 500;
}

.tooltip-text::after {
  content: "";
  position: fixed;
  top: 100%;
  left: 50%;
  margin-left: -7px;
  border-width: 7px;
  border-style: solid;
  border-color: var(--tooltip-bg) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip-text.tooltip-fade, .tooltip-text.tooltip-fade::after {
  opacity: 1;
}

.tooltip-text.tooltip-hide-arrow::after {
  opacity: 0;
}

@keyframes throb {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.throb {
  animation: throb 1s ease-in-out infinite;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
  border: 3px solid var(--color-bg);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
  border-radius: 4px;
  border: 3px solid var(--color-bg);
  background-clip: padding-box;
}

/* For Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) var(--color-bg);
}

/* Dark mode specific scrollbar adjustments */
@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    border: 3px solid #333;
    background-clip: padding-box;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    border: 3px solid #333;
    background-clip: padding-box;
  }

  * {
    scrollbar-color: rgba(255, 255, 255, 0.2) #333;
  }
}




/* Icon Picker */

.icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--form-radius);
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
}

.icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--color-box);
  border-radius: 2px;
  transition: all 0.15s ease;
  border: 2px solid transparent;
  width: 60px;
  height: 50px;
}

.icon-option:hover {
  background: var(--button-bg-hover);
  transform: translateY(-1px);
}

.icon-option.selected {
  background: var(--button-bg);
  border: 2px solid var(--color-border-hover);
}

.icon-option i {
  font-size: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  .icon-grid {
    background: #333;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .icon-option {
    background: #444;
    color: white;
  }

  .icon-option:hover {
    background: #555;
  }

  .icon-option.selected {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
  }
}



/* Upload overlay styles */
.upload-overlay {
  transition: opacity 0.2s ease-in-out;
}

/* Enhanced border and background when dragging files over the overlay */
.upload-overlay.drag-active {
  border-color: #4a9eff !important;
  background-color: rgba(74, 158, 255, 0.05) !important;
}

.upload-overlay.drag-active .ph-upload {
  color: #4a9eff !important;
}

input[type=checkbox] {
  accent-color: black;
}

@media (prefers-color-scheme: dark) {
  input[type=checkbox] {
    accent-color: white;
  }
}


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

.anim-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin-hourglass {
  0% {
    transform: rotate(0deg);
    animation-timing-function: cubic-bezier(0.55, 0.05, 0.67, 0.13);
  }
  50% {
    transform: rotate(180deg);
    animation-timing-function: cubic-bezier(0.41, 0.8, 0.6, 1);
  }
  100% {
    transform: rotate(180deg);
  }
}

.anim-spin-hourglass {
  animation: spin-hourglass 1s linear infinite;
}


.keyboard-shortcut {
  font-size: 0.75rem;
  padding: 2px 4px;
  margin-left: 8px;
  border-radius: 4px;
  background-color: var(--button-bg);
  color: var(--color-text-muted);
  font-family: monospace;
}

/* Show shortcuts when in help mode */
html.show-shortcuts .keyboard-shortcut {
  display: inline-block !important;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .keyboard-shortcut {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
  }
}

/* Search form styles */
.search-input {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.search-button {
  margin-left: 0 !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

/* Pagination container styles */
.pagination-container {
  padding-top: var(--base-spacing);
  padding-bottom: calc(var(--base-spacing)/2);
  padding-left: var(--base-spacing);
  padding-right: var(--base-spacing);
}

/* Style the pagination component itself */
.pagination {
  text-align: center;
  display: flex;
  align-items: center;
  gap: calc(var(--base-spacing)/2);
}


.popover {
  z-index: 2;
  width: 300px;
  padding: 1rem;
  background: var(--color-box, white);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  height: 100vh;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 600px;
  max-width: 80vw;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(0, 0, 0, 0.3);

  @media (prefers-color-scheme: dark) {
    background: #444;
  }
}

.popover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 100;
  cursor: pointer;
}

/* Add these new styles */
.action-history-container {
  flex-grow: 1;
  min-width: 300px;
  max-height: 55vh;
  overflow-y: auto;
}

.records-container {
  max-height: 55vh;
  overflow-y: auto;
  flex: 1;
}

q-r canvas {
  image-rendering: pixelated;
  width: 100%;
  height: 100%;
}

/* Clickable table styles */
.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
}

.sortable-header:hover {
  background-color: var(--table-td-hover-bg) !important;
}

.clickable-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clickable-row:hover {
  background-color: var(--table-td-hover-bg) !important;
}

/* Prevent click events on action buttons from bubbling to the row */
.clickable-row .button,
.clickable-row a {
  position: relative;
  z-index: 1;
}

.clickable-row td:last-child {
  position: relative;
  /* z-index: 2; */
}


/* Entry Partial */

.entry-row {
  padding: var(--base-spacing) 0;
  &:not(:last-of-type) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  &:first-of-type {
    padding-top: 0;
  }

  &:last-of-type {
    padding-bottom: 0;
  }
}



.image-container {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  width: 100%;
  height: 100%;
  &.cover {
    background-size: cover;
  }
}


.entry-type-field-form {
  .remove-button {
    opacity: 0;
  }
  &:hover,
  &:focus {
    .remove-button {
      opacity: 1;
    }
  }
}


.lifecycle-link {
  position: relative;
  text-decoration: none;
  background-color: var(--color-box);
  color: var(--color-text);
  padding: calc(var(--base-spacing)) calc(var(--base-spacing) * 2);
  border-radius: var(--form-radius);
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--color-border);  
  max-width: 320px;
  max-height: 320px;
  &:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    .title {
      top: -15px;
    }
    .details {
      opacity: 1;
    }
  }

  .details {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px;
    background: black;
    color: white;
    font-family: var(--font-stack-monospace);
    font-size: 0.8rem;
    padding: calc(var(--base-spacing) / 2);
    opacity: 0;
    pointer-events: none;
    margin: 0 auto;
  }

  .title {
    transition: all 0.15s ease;
    background: black;
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    top: -10px; left: 50%;
    transform: translateX(-50%);
    position: absolute;
    border: 1px solid var(--color-border);
    width: 75%;
    text-align: center;
  }
}

.markdown-body {
  line-height: 1.5;
  h1, h2, h3, h4, h5, h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  p { margin-top: 0.25rem; margin-bottom: 1rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 0.9rem; }
  h6 { font-size: 0.8rem; }
  ul { list-style-type: square; }
  li { margin-bottom: 0.25rem; }
}

/* Typeahead Results Styling */
.typeahead-results {
  background-color: var(--input-bg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
}

.typeahead-result {
  cursor: pointer;
  transition: background-color 0.1s ease;
  color: var(--color-text);
}

.typeahead-result:hover {
  background-color: var(--button-bg-hover);
}


.highlight {
  background-color: var(--color-highlight);
  @media (prefers-color-scheme: dark) {
    color: black;
  }
}

.highlight-slant {
  position: relative;
  display: inline-block;
  z-index: 0;
  &:before {
    content: "";
    display: block;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    transform: translateY(7%) skew(10deg) translateX(-2%) rotate(-1deg);
    height: 100%;
    background-color: yellow;
    z-index: -1;
  }
  @media (prefers-color-scheme: dark) {
    color: black;
  }
}

/* Git diff styling */
.diff-container {
  font-family: var(--font-stack-monospace);
  font-size: 14px;
  line-height: 1.6;
  background-color: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}

.diff-line {
  display: flex;
  white-space: nowrap;
  padding: 2px 0;
  min-width: max-content;
}

.diff-marker {
  padding: 0 8px;
  font-weight: bold;
  user-select: none;
  flex-shrink: 0;
}

.diff-content {
  flex: 1;
  white-space: pre;
  word-break: break-word;
  overflow-wrap: break-word;
  padding-right: 0;
}

.diff-context {
  background-color: transparent;
  color: var(--color-text);
}

.diff-added {
  background-color: #c3e6cb;
  color: #155724;
}

.diff-removed {
  background-color: #f5c6cb;
  color: #721c24;
}

@media (prefers-color-scheme: dark) {
  .diff-container {
    background-color: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .diff-context {
    background-color: transparent;
    color: var(--color-text);
  }

  .diff-added {
    background-color: rgba(40, 167, 69, 0.2);
    color: #90ee90;
  }

  .diff-removed {
    background-color: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
  }
}

.embed-container {
  border: 1px solid var(--color-border);
  width: 50%; max-width: 600px; height: 100%; overflow: hidden; flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--box-radius);
}

.embedded-header {
  background-color: var(--color-box);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: var(--box-radius) var(--box-radius) 0 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);

  /* Dark mode */
  @media (prefers-color-scheme: dark) {
    background-color: #444;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.05);
  }
}
