.borehole-account-intro {
  padding-top: 0;
}

.borehole-account-hero {
  width: 100%;
  padding: clamp(26px, 4vw, 42px);
}

.borehole-account-hero h1 {
  margin: 14px 0 0;
}

.borehole-account-hero p {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--color-text-muted);
}

.borehole-hero-actions,
.borehole-form-actions,
.borehole-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.borehole-back-nav {
  margin-bottom: 14px;
}

.borehole-back-nav a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.borehole-back-nav a:hover {
  color: var(--color-primary);
}

.borehole-list {
  display: grid;
  gap: 16px;
}

.borehole-card {
  padding: 0;
}

.borehole-card .workspace-card__summary {
  align-items: stretch;
  min-height: 105px;
  padding: 22px;
}

.borehole-add-card {
  min-height: 107px;
}

.borehole-card:not([open]):hover,
.borehole-card:not([open]):focus-within {
  border-color: var(--color-border-strong);
  background: var(--color-surface-2);
}

.borehole-card-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.borehole-card .project-card__meta {
  align-items: flex-start;
  flex: 1;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 6px;
  padding-block: 0;
}

.borehole-card .project-code {
  display: block;
  max-width: min(100%, 360px);
  overflow: hidden;
  letter-spacing: .025em;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.borehole-card .workspace-card__context {
  max-width: min(100%, 440px);
  line-height: 1.25;
}

.borehole-card .workspace-card__summary-aside,
.borehole-card-stats {
  align-self: stretch;
}

.borehole-card__notes {
  max-width: 760px;
  margin: -4px 0 18px;
  color: var(--color-text-muted);
}

.borehole-workspace-toolbar {
  align-items: flex-end;
}

.borehole-workspace-toolbar__field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.borehole-workspace-toolbar__field--sort select {
  width: 190px;
  min-width: 190px;
}

.borehole-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 10px;
  margin: 0;
}

.borehole-card-stats div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
}

.borehole-card-stats dt {
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.borehole-card-stats dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.borehole-card-actions {
  margin-top: 0;
  padding-top: 18px;
  border-top: 1px solid var(--color-divider);
}

.borehole-card-actions form {
  margin: 0;
}

.borehole-delete-button {
  border: 1px solid color-mix(in srgb, #b91c1c 28%, var(--color-border));
  background: color-mix(in srgb, #b91c1c 6%, var(--color-surface-2));
  color: #b91c1c;
}

.borehole-log {
  --borehole-log-ink: #243336;
  overflow: hidden;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-border) 45%, transparent);
}

.borehole-log__header,
.borehole-log__row {
  display: grid;
  grid-template-columns:
    48px
    minmax(76px, .62fr)
    minmax(102px, .78fr)
    minmax(72px, .56fr)
    106px
    minmax(220px, 2.7fr);
}

.borehole-log__header {
  min-height: 86px;
  border-bottom: 1px solid var(--color-border-strong);
  background: var(--color-surface-2);
}

.borehole-log__header > div {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 9px 7px;
  border-right: 1px solid var(--color-border-strong);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.borehole-log__header > div:last-child,
.borehole-log__cell:last-child {
  border-right: 0;
}

.borehole-log__depth-heading {
  grid-template-rows: 1fr auto;
  padding: 0 !important;
}

.borehole-log__depth-heading > span:first-child {
  display: grid;
  align-self: stretch;
  place-items: center;
  padding: 8px 5px;
}

.borehole-log__depth-subheading {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--color-border-strong);
}

.borehole-log__depth-subheading i {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  padding: 5px;
  font-style: normal;
}

.borehole-log__depth-subheading i + i {
  border-left: 1px solid var(--color-border-strong);
}

.borehole-log__row {
  min-height: var(--layer-height);
  border-bottom: 1px solid var(--color-border-strong);
}

.borehole-log__row:last-child {
  border-bottom: 0;
}

.borehole-log__cell {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 10px 8px;
  border-right: 1px solid var(--color-border-strong);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: .86rem;
  line-height: 1.35;
  text-align: center;
}

.borehole-log__index,
.borehole-log__ige,
.borehole-log__thickness {
  font-weight: 800;
}

.borehole-log__ige {
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: .82rem;
  font-style: normal;
  letter-spacing: .02em;
}

.borehole-log__depth {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: stretch;
  overflow: hidden;
  padding: 0;
}

.borehole-log__depth span {
  display: grid;
  width: 100%;
  min-width: 0;
  align-self: stretch;
  place-items: center;
  padding: 8px 4px;
}

.borehole-log__depth span + span {
  border-left: 1px solid var(--color-border-strong);
}

.borehole-log__section {
  min-height: var(--layer-height);
  padding: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--soil-color, #d9d6ce) 72%, #f7f6f2);
}

.borehole-log__pattern {
  position: absolute;
  inset: 0;
  opacity: .66;
}

.borehole-log__pattern[data-pattern="dusty-sand"] {
  background-image: radial-gradient(circle, rgba(20, 43, 46, .66) 0 1px, transparent 1.2px);
  background-size: 7px 7px;
}

.borehole-log__pattern[data-pattern="loam"] {
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, rgba(20, 43, 46, .58) 10px 11.5px);
}

.borehole-log__pattern[data-pattern="gravelly-sand"] {
  background-image:
    radial-gradient(circle, transparent 0 5px, rgba(20, 43, 46, .58) 5px 6.4px, transparent 6.6px),
    radial-gradient(circle, transparent 0 4px, rgba(20, 43, 46, .48) 4px 5.3px, transparent 5.5px);
  background-position: 0 0, 17px 15px;
  background-size: 34px 30px;
}

.borehole-log__pattern[data-pattern="coarse-sand"] {
  background-image:
    radial-gradient(circle, transparent 0 3.4px, rgba(20, 43, 46, .6) 3.4px 4.7px, transparent 4.9px),
    radial-gradient(circle, transparent 0 2.7px, rgba(20, 43, 46, .48) 2.7px 3.8px, transparent 4px);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.borehole-log__pattern[data-pattern="fill"] {
  background-image:
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(20, 43, 46, .54) 11px 12.5px),
    repeating-linear-gradient(45deg, transparent 0 11px, rgba(20, 43, 46, .46) 11px 12.5px);
}

.borehole-log__pattern[data-pattern="clay"] {
  background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(20, 43, 46, .58) 5px 6.5px);
}

.borehole-log__pattern[data-pattern="sandy-loam"] {
  background-image:
    radial-gradient(circle, rgba(20, 43, 46, .62) 0 1px, transparent 1.2px),
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(20, 43, 46, .52) 11px 12.5px);
  background-size: 8px 8px, auto;
}

.borehole-log__pattern[data-pattern="sand"] {
  background-image: radial-gradient(circle, rgba(20, 43, 46, .62) 0 1.6px, transparent 1.8px);
  background-size: 10px 10px;
}

.borehole-log__well {
  position: absolute;
  z-index: 1;
  top: -1px;
  bottom: -1px;
  left: 50%;
  width: 14px;
  overflow: hidden;
  border-right: 2px solid var(--borehole-log-ink);
  border-left: 2px solid var(--borehole-log-ink);
  background: #fff;
  transform: translateX(-50%);
}

.borehole-log__well-water {
  position: absolute;
  z-index: 1;
  top: clamp(0%, var(--water-position), 100%);
  right: 0;
  bottom: 0;
  left: 0;
  background: #68b8d2;
}

.borehole-log__well-water.is-full {
  top: 0;
}

.borehole-log__water-label {
  position: absolute;
  z-index: 2;
  top: clamp(8px, var(--water-position), calc(100% - 25px));
  left: 50%;
  width: max-content;
  max-width: 70px;
  padding: 2px 4px;
  border: 1px solid color-mix(in srgb, #2583a3 45%, var(--color-border));
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  color: var(--color-primary);
  font-size: .58rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  transform: translate(-50%, -50%);
}

.borehole-log__description {
  align-content: center;
  justify-items: start;
  padding: 12px 14px;
  text-align: left;
}

.borehole-log__description strong {
  font-size: .9rem;
  line-height: 1.35;
}

.borehole-log__properties {
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: .7rem;
  line-height: 1.45;
}

.borehole-log__tag {
  margin-top: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.borehole-empty {
  display: grid;
  justify-items: center;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 64px);
  text-align: center;
}

.borehole-empty-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 2rem;
}

.borehole-empty h2 {
  margin: 20px 0 8px;
}

.borehole-empty p {
  max-width: 560px;
  margin: 0 0 22px;
  color: var(--color-text-muted);
}

.borehole-form {
  display: grid;
  gap: 18px;
}

.borehole-meta-panel,
.borehole-layers-panel {
  padding: clamp(22px, 4vw, 34px);
}

.borehole-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.borehole-panel-heading h2 {
  margin: 10px 0 0;
  font-size: 1.35rem;
}

.borehole-panel-heading p {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.borehole-meta-fields,
.borehole-layer-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.borehole-field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  font-weight: 700;
}

.borehole-field--wide {
  grid-column: 1 / -1;
}

.borehole-field input,
.borehole-field select,
.borehole-field textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: 13px;
  background: var(--color-surface-2);
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  outline: none;
}

.borehole-field input {
  min-height: 49px;
}

.borehole-field input:focus,
.borehole-field select:focus,
.borehole-field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.borehole-layer-list {
  display: grid;
  gap: 10px;
}

.borehole-layer {
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-offset);
}

.borehole-layer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.borehole-layer-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.borehole-layer-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.borehole-layer-range {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.borehole-layer-remove {
  color: #b91c1c;
  font-size: 0.8rem;
  font-weight: 800;
}

.borehole-layer-fields {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.borehole-layer-fields--stratigraphy {
  grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr);
}

.borehole-field--double {
  grid-column: span 2;
}

.borehole-color-field input {
  padding: 6px;
}

.borehole-layer .borehole-field {
  gap: 5px;
  font-size: 0.78rem;
}

.borehole-layer .borehole-field input,
.borehole-layer .borehole-field select {
  min-height: 41px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
}

.borehole-checkbox-field {
  display: flex;
  align-items: center;
  align-self: end;
  min-height: 41px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
}

.borehole-checkbox-field input {
  width: 18px;
  min-height: 18px !important;
  margin: 0;
}

.borehole-checkbox-field span {
  line-height: 1.2;
}

.borehole-form-error {
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, #b91c1c 28%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, #b91c1c 7%, var(--color-surface-2));
  color: #b91c1c;
  font-weight: 700;
}

@media (max-width: 880px) {
  .borehole-card-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .borehole-layer-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .borehole-layer-fields--stratigraphy {
    grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr);
  }

  .borehole-log__header,
  .borehole-log__row {
    grid-template-columns: 42px 70px 94px 64px 94px minmax(160px, 1fr);
  }
}

@media (max-width: 760px) {
  .borehole-workspace-toolbar {
    align-items: stretch;
  }

  .borehole-workspace-toolbar__field,
  .borehole-workspace-toolbar__field--sort select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .borehole-panel-heading,
  .borehole-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .borehole-meta-fields,
  .borehole-layer-fields {
    grid-template-columns: 1fr;
  }

  .borehole-card .workspace-card__summary {
    grid-template-columns: 1fr;
    height: auto;
  }

  .borehole-card .project-card__meta {
    min-height: 62px;
  }

  .borehole-card .workspace-card__summary-aside {
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
  }

  .borehole-card-stats {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .borehole-add-card {
    min-height: 0;
  }

  .borehole-log {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .borehole-log__header {
    display: none;
  }

  .borehole-log__body {
    display: grid;
    min-width: 0;
    gap: 10px;
  }

  .borehole-log__row {
    display: grid;
    min-height: 0;
    grid-template-columns: 48px minmax(0, 1fr) 76px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
  }

  .borehole-log__cell {
    min-height: 52px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }

  .borehole-log__cell::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-muted);
    font-size: .58rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.15;
    text-transform: uppercase;
  }

  .borehole-log__index {
    grid-row: span 2;
  }

  .borehole-log__ige {
    justify-items: start;
    text-align: left;
  }

  .borehole-log__depth {
    grid-template-columns: 1fr 1fr;
    padding: 0;
  }

  .borehole-log__depth::before {
    position: absolute;
    top: 4px;
    left: 0;
    width: 100%;
    text-align: center;
  }

  .borehole-log__depth span {
    padding-top: 18px;
  }

  .borehole-log__section {
    min-height: 104px;
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .borehole-log__section::before {
    display: none;
  }

  .borehole-log__description {
    min-height: 0;
    grid-column: 1 / -1;
    align-items: start;
    border-right: 0;
    border-bottom: 0;
  }

  .borehole-log__description::before {
    margin-bottom: 7px;
  }

  .borehole-field--wide,
  .borehole-field--double {
    grid-column: auto;
  }

  .borehole-form-actions .btn,
  .borehole-hero-actions .btn,
  .borehole-card-actions .btn,
  .borehole-card-actions form {
    width: 100%;
  }
}
