@layer km-base {
  #record .record-date-row {
    display: flex;
    flex-direction: column;
    gap: var(--km-space-sm);
    margin-bottom: var(--km-space-md);
  }


  #record .record-context-block {
    margin: var(--km-space-md) 0 var(--km-space-sm);
  }

  #record .record-subtitle {
    margin: var(--km-space-sm) 0;
    font-size: var(--km-font-section);
    line-height: 1.55;
    font-weight: var(--km-weight-semibold);
    color: var(--km-color-title);
  }

  #record .context-help {
    margin: 0 0 var(--km-space-sm);
  }

  #recordFields .record-condition-field {
    display: block;
    margin: var(--km-space-md) 0 var(--km-space-sm);
  }

  #recordFields .record-condition-heading {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: var(--km-space-sm);
    min-width: 0;
  }

  #recordFields .record-condition-heading .record-condition-name,
  #recordFields .record-condition-heading .record-condition-scale {
    margin: 0;
  }

  #recordFields .record-condition-name {
    font-size: var(--km-font-body);
    line-height: 1.45;
    font-weight: var(--km-weight-medium);
    color: var(--km-color-body);
  }

  #recordFields .record-condition-scale {
    font-size: var(--km-font-body);
    line-height: 1.5;
    color: var(--km-color-muted);
  }

  #recordFields .range-row {
    margin-top: var(--km-space-sm);
    gap: var(--km-space-sm);
  }

  #recordFields .range-row .score {
    flex: 0 0 30px;
    width: 30px;
    text-align: center;
    white-space: nowrap;
    color: var(--km-color-title);
    font-weight: var(--km-weight-semibold);
  }

  #recordFields .range-row input[type="range"] {
    --range-pct: 50%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    outline: none;
    cursor: pointer;
  }

  #recordFields .range-row input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    border: 0;
    border-radius: var(--km-radius-pill);
  }

  #recordFields .range-row input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    margin-top: calc(-1 * var(--km-space-xs));
    border: 3px solid var(--km-color-card);
    border-radius: var(--km-radius-circle);
    background: var(--km-color-primary);
    box-shadow: 0 0 0 1px var(--km-color-focus-outline);
  }

  #recordFields .range-row input[type="range"]::-moz-range-track {
    height: 10px;
    border: 0;
    border-radius: var(--km-radius-pill);
  }

  #recordFields .range-row input[type="range"]::-moz-range-progress {
    height: 10px;
    border: 0;
    border-radius: var(--km-radius-pill);
  }

  #recordFields .range-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 3px solid var(--km-color-card);
    border-radius: var(--km-radius-circle);
    background: var(--km-color-primary);
    box-shadow: 0 0 0 1px var(--km-color-focus-outline);
  }

  #record #note {
    min-height: var(--km-control-min-height);
    height: auto;
    padding-block: var(--km-space-sm);
    overflow-y: hidden;
  }

  #record .record-note-meta-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--km-space-sm);
    margin-top: var(--km-space-xs);
  }

  #record .today-note-count {
    flex: 0 0 auto;
    margin: 0;
    text-align: right;
    white-space: nowrap;
    color: var(--km-color-muted);
  }

  @media (max-width:600px) {
    #recordFields .record-condition-field {
      display: block;
      margin: var(--km-space-md) 0 var(--km-space-md);
    }

    #recordFields .record-condition-heading {
      gap: var(--km-space-sm);
      width: 100%;
      white-space: nowrap;
    }

    #recordFields .record-condition-name {
      display: inline;
      flex: 0 0 auto;
      font-size: var(--km-font-body);
      line-height: 1.35;
      white-space: nowrap;
    }

    #recordFields .record-condition-scale {
      display: inline;
      flex: 0 0 auto;
      margin: 0;
      font-size: var(--km-font-meta);
      line-height: 1.35;
      white-space: nowrap;
      overflow-wrap: normal;
    }

    #recordFields .range-row {
      margin-top: var(--km-space-sm);
      gap: var(--km-space-sm);
    }

    #recordFields .range-row .score {
      flex: 0 0 30px;
      width: 30px;
    }
  }
}

@layer km-priority {
  #recordFields .range-row input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right,var(--km-color-primary) 0%,var(--km-color-primary) var(--range-pct),var(--km-color-bg-blue-soft) var(--range-pct),var(--km-color-bg-blue-soft) 100%);
  }

  #recordFields .range-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
  }

  #recordFields .range-row input[type="range"]::-moz-range-track {
    background: var(--km-color-bg-blue-soft);
  }

  #recordFields .range-row input[type="range"]::-moz-range-progress {
    background: var(--km-color-primary);
  }

  #recordFields .range-row input[type="range"]:focus,
  #recordFields .range-row input[type="range"]:focus-visible {
    outline: none;
  }

  #recordFields .range-row input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px var(--km-color-accent), var(--km-focus-ring);
  }

  #recordFields .range-row input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 1px var(--km-color-accent), var(--km-focus-ring);
  }

  #record .today-note-count {
    font-size: var(--km-font-meta);
    line-height: 1.4;
  }
}

@layer km-base {
  .km-page--record .record-note-preview {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
  }
}
