#navigation .nav-parent-current { color: var(--accent); }
.nav-children {
  display: grid;
  gap: 2px;
  margin: 0 0 6px 1.3rem;
  border-left: 1px solid var(--line);
  padding-left: .6rem;
}
#navigation .nav-children a {
  font-size: .84rem;
  line-height: 1.3;
  padding: .45rem .65rem;
}
.directory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
}
.directory-filters .field { flex: 1 1 12rem; }
#content[data-view="admin"] .field:has(> [name="filter-level"]),
#content[data-view="admin"] .field:has(> [name="tariff-year"]) { max-width: 24rem; }
.norm-matrix .table-scroll table {
  table-layout: fixed;
  min-width: 60rem;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.norm-matrix td, .norm-matrix th { vertical-align: middle; padding-inline: .55rem; }
.norm-matrix th { overflow-wrap: normal; }
.norm-matrix .tag, .norm-matrix button { white-space: nowrap; }
.norm-matrix th:first-child, .norm-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: nowrap;
  background-color: white;
  box-shadow: 1px 0 0 var(--line);
}
.norm-matrix th:first-child { background-color: var(--page); }
.norm-matrix th:first-child { width: 7.1rem; }
.norm-matrix th:nth-last-child(2) { width: 13%; }
.norm-matrix th:last-child { width: 8rem; }
.norm-matrix td:last-child button { margin-block: .15rem; }
.matrix-value {
  color: var(--accent);
  background-color: transparent;
  border-color: transparent;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: .36rem .5rem;
  margin-left: -.5rem;
}
.matrix-value:hover { background: var(--tint); border-color: var(--line); }
dialog.edit-drawer {
  box-sizing: border-box;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(46rem, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding: 0 clamp(1rem, 3vw, 2rem) 1rem;
}
dialog.edit-drawer::backdrop { background: rgb(22 43 70 / 30%); }
dialog.edit-drawer .dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  padding-block: 1.1rem;
  margin-bottom: 1rem;
  background: white;
  border-bottom: 1px solid var(--line);
}
dialog.edit-drawer .dialog-head h2 { margin: 0; }
dialog.edit-drawer .record-links { margin: .5rem 0 1rem; }
dialog.edit-drawer form > .actions.end {
  position: sticky;
  bottom: -1rem;
  z-index: 1;
  margin-block: 1.5rem 0;
  padding: .85rem 0;
  border-top: 1px solid var(--line);
  background: white;
}
dialog.edit-drawer .actions.end .danger { margin-right: auto; }
dialog.edit-drawer .dialog-errors:not([hidden]) { scroll-margin-top: 6rem; }
@media (max-width: 600px) {
  dialog.edit-drawer .grid { grid-template-columns: minmax(0, 1fr); }
  .directory-filters { gap: 0; }
}

.pick-field { min-width: 0; }
.pick-controls { position: relative; display: flex; align-items: stretch; gap: .25rem; min-width: 0; }
.pick-controls select { flex: 1 1 auto; width: 100%; min-width: 0; }
.pick-trigger, .record-icon {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  min-height: 2.2rem; min-width: 2.2rem; padding: .42rem; line-height: 1;
}
.pick-trigger svg, .record-icon svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pick-controls select:disabled + .pick-trigger { display: none; }
.pick-popup { position: absolute; top: calc(100% + .2rem); left: 0; z-index: 5; box-sizing: border-box; width: 100%; padding: .45rem; border: 1px solid var(--line); border-radius: .5rem; background: white; box-shadow: 0 .5rem 1.5rem rgb(18 46 86 / 15%); }
.pick-popup input { width: 100%; }
.pick-list { max-height: 13rem; overflow-y: auto; overscroll-behavior: contain; }
.pick-list [role=option], .pick-status:not(:empty) { padding: .45rem .5rem; font-weight: 400; overflow-wrap: anywhere; }
.pick-list [role=option] { cursor: pointer; }
.pick-list .highlighted, .pick-list [role=option]:hover { background: var(--tint); }
.table-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.tariff-actions { margin-block: .25rem; }
.norm-matrix .factor-readonly { display: none; }
.norm-matrix [data-actions-hidden="true"] .factor-readonly { display: inline; }
.norm-matrix [data-actions-hidden="true"] [data-do="factor"] { display: none; }
.tariff-amount-group td { background: var(--page); }
.tariff-amount-group button { padding: .38rem .7rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tariff-amount-group td > span { margin-left: .5rem; color: var(--muted); font-size: .88em; }
.tariff-actions small { margin-top: .25rem; }
.tariff-readonly { display: none; }
[data-actions-hidden="true"] .tariff-readonly { display: inline; }
[data-actions-hidden="true"] .tariff-value { display: none; }

/* Keep row actions within reach on desktop; narrow screens scroll the table itself. */
.table-scroll table[data-table-key^="directory-"]:not([data-table-key="directory-norms"]) {
  table-layout: fixed;
  width: 100%;
  min-width: max(100%, calc(var(--visible-columns, 4) * 6.75rem));
}
.table-scroll table[data-table-key^="directory-"] th:has(.action-heading) { width: 6.5rem; }
.table-scroll table[data-table-key="directory-tariffs"] th:has(.action-heading) { width: 8.5rem; }
.table-scroll table[data-table-key="directory-tariffs-amount"] th:has(.profile-heading) { width: 23%; }
.table-scroll table[data-table-key^="directory-"] :is(td, th) { overflow-wrap: break-word; }
