@layer features {
  .records-shell {
    display: grid;
    gap: 18px;
  }

  .records-nav {
    padding: 7px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .records-nav a {
    min-width: max-content;
    padding: 9px 11px;
    color: var(--muted);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 500;
  }

  .records-nav a:hover,
  .records-nav a[aria-current="page"] {
    color: var(--ink);
    background: var(--green-soft);
  }

  .records-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .records-summary article {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 15px;
  }

  .records-summary strong {
    display: block;
    margin-bottom: 5px;
    font-size: 23px;
    letter-spacing: -.04em;
  }

  .records-summary span {
    color: var(--muted);
    font-size: 11px;
  }

  .records-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
  }

  .records-dashboard-card {
    min-height: 158px;
    padding: 19px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .15s, box-shadow .15s;
  }

  .records-dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
  }

  .records-dashboard-card h2 {
    margin: 0 0 7px;
    font-size: 16px;
  }

  .records-dashboard-card p {
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 12px;
  }

  .records-dashboard-card footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    color: var(--green);
    font-size: 11px;
    font-weight: 600;
  }

  .records-toolbar {
    padding: 14px;
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid var(--line);
  }

  .records-toolbar .form-field {
    min-width: 155px;
    margin: 0;
  }

  .records-toolbar .form-field:first-child {
    min-width: min(320px, 100%);
    flex: 1;
  }

  .records-toolbar label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
  }

  .records-toolbar input,
  .records-toolbar select {
    width: 100%;
    height: 36px;
    padding: 9px 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
  }

  .records-empty {
    padding: 45px 22px;
    text-align: center;
  }

  .records-empty h2 {
    margin-bottom: 7px;
    font-size: 16px;
  }

  .records-empty p {
    max-width: 430px;
    margin: 0 auto 17px;
    color: var(--muted);
    font-size: 12px;
  }

  .records-shell .records-table th {
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  .records-shell .records-table td {
    vertical-align: middle;
  }

  .records-shell .records-table tbody tr:hover {
    background: var(--surface-soft);
  }

  .records-shell .records-table td strong,
  .records-shell .records-table td small {
    display: block;
  }

  .records-shell .records-table td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
  }

  .records-shell .records-table-link {
    color: var(--green);
    font-weight: 600;
  }

  .records-shell .form-section:last-of-type {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .records-shell .form-field {
    min-width: 0;
  }

  .records-shell .form-field textarea {
    resize: vertical;
  }

  .records-shell .form-field input:focus,
  .records-shell .form-field select:focus,
  .records-shell .form-field textarea:focus {
    border-color: var(--line);
    outline: 3px solid var(--green-soft);
  }

  .records-shell .form-check input {
    margin-top: 2px;
  }

  .records-shell .form-check label {
    margin: 0;
    color: var(--ink);
  }

  .records-shell .form-actions {
    padding-top: 4px;
  }

  .records-shell .form-errors h2 {
    margin-bottom: 8px;
    font-size: 13px;
  }

  .records-shell .form-errors ul {
    margin: 0;
    padding-left: 18px;
    font-size: 11px;
  }

  .form-map-canvas {
    min-height: 330px;
    overflow: hidden;
    background: #d9e2d3;
    border: 1px solid var(--line);
    border-radius: 13px;
  }

  .detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(270px, .75fr);
    gap: 16px;
    align-items: start;
  }

  .records-shell .detail-panel h2 {
    margin-bottom: 17px;
    font-size: 15px;
  }

  .records-shell .detail-list div {
    min-width: 0;
  }

  .records-shell .detail-list .detail-wide {
    grid-column: 1 / -1;
  }

  .records-shell .detail-list dt {
    letter-spacing: .04em;
  }

  .records-shell .detail-list dd {
    overflow-wrap: anywhere;
  }

  .detail-stack {
    display: grid;
    gap: 16px;
  }

  .detail-relationship {
    margin-top: 16px;
  }

  .detail-relationship .panel-heading {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
  }

  .records-danger {
    color: #8f3f37;
    border-color: var(--line);
  }

  .records-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .map-editor-toolbar {
    margin-top: 13px;
  }

  .map-editor-toolbar .text-link {
    padding: 8px;
    background: transparent;
    border: 0;
  }

  .map-editor-status {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
  }

  .area-vertex {
    background: var(--surface);
    border: 4px solid var(--green);
    border-radius: 50%;
    box-shadow: 0 2px 7px rgba(0, 0, 0, .28);
  }

  @media (max-width: 980px) {
    .records-dashboard-grid {
      grid-template-columns: repeat(2, 1fr);
    }

    .records-summary {
      grid-template-columns: repeat(2, 1fr);
    }

    .detail-layout {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 680px) {
    .records-dashboard-grid,
    .records-summary {
      grid-template-columns: 1fr;
    }

    .records-header-actions {
      width: 100%;
    }

    .records-shell .detail-list .detail-wide {
      grid-column: auto;
    }

    .records-shell .records-form-panel {
      padding: 24px;
    }

    .records-toolbar {
      align-items: stretch;
    }

    .records-toolbar .form-field {
      width: 100%;
    }

    .map-editor-status {
      width: 100%;
      margin-left: 0;
    }
  }
}
