/* Shared console controls, layout and feature-specific exceptions. */
.record-selection {
  margin: 16px 0 10px;
  padding: 12px 14px;
  border: 1px solid #dfe7ea;
  border-radius: 8px;
  background: #fff;
}

.selection-topline,
.selection-controls,
.selection-batch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-topline {
  justify-content: space-between;
  gap: 10px 16px;
}

.selection-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  font-size: 12px;
  line-height: 20px;
}

.selection-summary strong {
  color: #192c34;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.selection-count {
  white-space: nowrap;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e8f5ef;
  color: #14765c;
  font-weight: 500;
}

.selection-controls button {
  min-height: 32px;
  padding: 6px 10px;
  background: var(--button-bg);
}

.selection-controls .quiet {
  background: var(--button-bg);
}

.selection-batch {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e8eef0;
}

.selection-batch label {
  flex-direction: row;
  gap: 8px;
}

.selection-batch input[type=number] {
  width: 100px;
}

.selection-batch .danger {
  border: 1px solid #edcfca;
  background: #fff7f5;
}

.selection-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: #dfe7ea;
}

@media (max-width: 650px) {
  .toolbar .grow,
  .toolbar .search-label {
    flex-basis: 100%;
    min-width: 0;
  }

  .selection-controls {
    gap: 6px;
  }

  .selection-divider {
    display: none;
  }

  .pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .pagination > label {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .pagination > span {
    grid-column: 2 / 4;
    grid-row: 1;
    justify-self: end;
    white-space: normal;
    text-align: right;
  }

  .pagination > button {
    grid-row: 2;
    min-width: 68px;
  }

  .pagination > button:first-of-type {
    grid-column: 2;
  }

  .pagination > button:last-of-type {
    grid-column: 3;
  }

  .shell > aside {
    padding: 16px 20px;
  }

  .shell > aside .brand {
    gap: 8px;
    font-size: 24px;
  }

  .shell > aside .brand span {
    font-size: 20px;
  }

  .shell > aside > nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: 14px;
  }

  .shell > aside > nav a {
    min-width: 0;
    padding: 9px 4px;
    border-left: 0;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
  }

  .shell > aside > nav a.active {
    border-left: 0;
    box-shadow: inset 0 -2px 0 #79dfbd;
  }
}

/* Network contribution periods and charts use the shared table/control density. */
.program-section-head .view-switch {display:flex;gap:3px;flex-wrap:wrap}
.program-period-summary {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:16px 20px;margin-bottom:16px;gap:16px}
.program-period-summary>div {display:flex;flex-direction:column;gap:7px;min-width:0}
.program-period-summary span {font-size:12px;color:var(--text-secondary)}
.program-period-summary strong {font-size:21px;font-weight:500;font-variant-numeric:tabular-nums}
.program-history {padding:18px 20px;margin-bottom:16px}
.program-history .section-head {margin-bottom:12px;flex-wrap:wrap}
.program-history h3 {font-size:13px;margin:0}
.program-history svg {width:100%;height:110px;display:block}
.program-history-legend {display:flex;align-items:center;gap:6px;font-size:11px;color:var(--text-secondary)}
.program-history-legend i {width:8px;height:8px;border-radius:2px;display:inline-block}
.program-history-legend .rx {background:#168c70}
.program-history-legend .tx {background:#437ac2;margin-left:8px}
.program-range {display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;font-size:11px;margin:8px 0 0}
.program-traffic-controls .search-label {flex:0 1 240px}
.program-accounting-notes {font-size:12px;color:var(--text-secondary);line-height:1.7;margin:12px 0}
.program-accounting-notes summary {cursor:pointer}
.program-accounting-notes p {margin:8px 0}
@media(max-width:650px){
 .program-section-head {align-items:flex-start}
 .program-period-summary {grid-template-columns:repeat(2,minmax(0,1fr));padding:14px 16px;gap:16px}
 .program-period-summary strong {font-size:19px}
 .program-history {padding:14px 16px}
 .program-section-head .view-switch {width:100%}
 .program-section-head .view-switch button {flex:1}
}
.program-history-legend .missing {background:#dce5e8;margin-left:8px}

/* Unified interaction language: all console controls share one compact rhythm. */
:root {
  --control-h: 34px;
  --control-radius: 6px;
  --control-border: #d5dfe2;
  --control-bg: #f1f5f5;
  --button-bg: #fff;
  --button-border: #93aaa2;
  --button-text: #24483e;
  --control-focus: #168c70;
  --control-gap: 10px;
}

button,
input,
select,
textarea {
  border-radius: var(--control-radius);
}

button {
  min-height: var(--control-h);
  padding: 7px 12px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease, box-shadow .12s ease;
}

button:hover:not(:disabled) {
  filter: none;
  border-color: #547d6e;
  background: var(--button-bg);
}

button.primary,
button.primary:hover:not(:disabled) {
  border-color: #168c70;
  background: #168c70;
  color: #fff;
}

button.quiet {
  border-color: var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
}

button.quiet:hover:not(:disabled) {
  border-color: #547d6e;
  background: var(--button-bg);
}

button.danger,
button.danger:hover:not(:disabled) {
  border-color: #edcfca;
  background: #fff7f5;
  color: #a84d42;
}

button:disabled,
button:is(.primary, .quiet, .danger):disabled {
  border-color: #c5d0cc;
  background: #edf1ef;
  color: #596762;
  opacity: 1;
  cursor: not-allowed;
}

:is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid #168c7066;
  outline-offset: 2px;
}

input,
select,
textarea {
  border: 1px solid var(--control-border);
}

input,
select {
  min-height: var(--control-h);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 18px;
}

textarea {
  padding: 9px 10px;
}

.toolbar,
.refresh-tools,
.pagination {
  gap: var(--control-gap);
}

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

.toolbar label {
  min-width: 120px;
}

.toolbar .grow,
.toolbar .search-label {
  flex: 1 1 220px;
  min-width: 180px;
}

.toolbar > .muted {
  align-self: center;
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 18px;
}

.toolbar > button,
.toolbar > label > button,
.section-head .refresh-tools > button {
  min-height: var(--control-h);
}

.section-head {
  min-height: 34px;
}

.section-head > h3 {
  line-height: 20px;
}

.view-switch {
  gap: 2px;
  padding: 3px;
  border: 1px solid #dfe7e8;
  border-radius: 7px;
  background: #eef3f3;
}

.view-switch button {
  min-height: 28px;
  padding: 4px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.view-switch button:hover:not(:disabled) {
  border-color: transparent;
  background: #e3ecea;
}

.view-switch button.active,
.view-switch button[aria-pressed="true"] {
  background: #fff;
  color: #14765c;
  box-shadow: 0 1px 3px #102e3512;
}

.pagination {
  min-height: var(--control-h);
  align-items: center;
}

.pagination label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.pagination :is(button, select) {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 20px;
}

.pagination select {
  min-width: 64px;
}

.pagination > button {
  min-width: 68px;
}

.tag,
.pill {
  border-radius: 5px;
  line-height: 16px;
}

.tag {
  padding: 2px 7px;
}

.alert,
.notice,
.success {
  border-radius: var(--control-radius);
}

@media (max-width: 650px) {
  :root { --control-gap: 8px; }
  .toolbar { align-items: stretch; }
  .toolbar > .muted { margin-bottom: 0; width: 100%; }
  .toolbar > button { min-width: 0; }
  .pagination { align-items: center; }
  .view-switch button { padding-left: 8px; padding-right: 8px; }
}

/* Labels, fields and actions align identically in every editor and filter bar. */
label,
.record-editor label,
.record-import > label {
  gap: 6px;
  font-size: 12px;
  line-height: 18px;
}

.toolbar :is(input, select),
.selection-batch input,
.form-row :is(input, select),
.dig-config-grid :is(input, select),
.dig-inputs :is(input, select),
.upstream-editor :is(input, select) {
  min-height: var(--control-h);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 18px;
}

.toolbar > button,
.section-head .refresh-tools > button,
.preset-buttons button,
.dig-presets button,
.dig-result .refresh-tools button,
.record-ttl-presets button,
.packet-toolbar button {
  min-height: var(--control-h);
  padding: 7px 12px;
  font-size: 12px;
  line-height: 18px;
}

:is(.dig-form, .records-panel, .allowed-clients) textarea {
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  padding: 10px 12px;
  font: 12px/1.7 ui-monospace, monospace;
}

:is(input, select, textarea):disabled {
  background: #f3f6f6;
  color: var(--text-muted);
  cursor: not-allowed;
}

input[type=checkbox],
input[type=radio] {
  min-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--control-focus);
  vertical-align: middle;
  flex-shrink: 0;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 0 10px;
  margin: 16px 0 20px;
  border-bottom: 1px solid #dfe7ea;
}

.detail-tabs button {
  min-height: var(--control-h);
  padding: 7px 12px;
  background: transparent;
  color: var(--text-secondary);
}

.detail-tabs button.active,
.detail-tabs button[aria-selected="true"] {
  background: #e5f5ee;
  color: #14765c;
}

.analytics-tabs.view-switch {
  display: inline-flex;
  max-width: 100%;
  gap: 2px;
  margin: 16px 0 0;
}

.program-section-head .view-switch {
  gap: 2px;
}

/* Common surfaces and messages, with feature-specific layout kept intact. */
.page-form,
.page-section {
  min-width: 0;
}

/* Full-page editors sit directly on the workspace; local cards remain panels. */
.authoritative-resources .zone-settings.page-section {
  padding: 0;
}

.toolbox-panel > .dig-history {
  margin-top: 0;
}

.panel {
  border-color: #dfe7ea;
  border-radius: 8px;
}

:is(.info-panel, .chart, .analytics-ranking, .record-editor, .record-import,
    .record-audit, .record-probe, .scenario-detail, .statistics-scope, .zone-settings) {
  padding: 20px;
}

.metrics .panel {
  padding: 20px;
}

/* Dig sections use the same card surfaces and spacing as the other pages. */
.dig-form fieldset > .dig-config-section.panel {
  border-top: 1px solid #dfe7ea;
  padding: 20px;
  margin-top: 24px;
  min-width: 0;
}

.dig-form fieldset > .dig-config-section.panel:first-child {
  margin-top: 0;
}

.dig-form .dig-config-section > .toolbar:last-child {
  margin-bottom: 0;
}

.dig-form > .dig-submit.panel {
  padding: 20px;
  margin-top: 24px;
}

:is(.metrics, .counter-grid) strong {
  font-variant-numeric: tabular-nums;
}

.analytics-extra-metrics .metric-link {
  font-size: 27px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.5px;
}

.alert,
.notice,
.success {
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.7;
  margin: 16px 0;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}

.alert {
  border-color: #f0d7d1;
  background: #fff3ef;
  color: #a64b3e;
}

.notice {
  border-color: #ecdcbf;
  background: #fcf7ed;
  color: #88662f;
}

.success {
  border-color: #c6e5d7;
  background: #edf8f2;
  color: #176e53;
}

.selection-count,
.tag,
.pill {
  background: #edf6f2;
  color: #286e5b;
  font-weight: 500;
}

.tag.bad,
.unhealthy {
  background: #fff0e9;
  color: #a85039;
}

:is(.schema-panel, .process-history) > summary,
:is(.scenario-batch, .scenario-capabilities) > summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 20px;
}

:is(.schema-panel, .process-history) > summary {
  padding: 16px 20px;
}

.query-dialog {
  padding: 24px;
  border-radius: 10px;
}

.detail-top > button {
  flex-shrink: 0;
}

.hint,
.geo-note {
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 650px) {
  .dig-form fieldset > .dig-config-section.panel,
  .dig-form > .dig-submit.panel {
    padding: 16px;
    margin-top: 20px;
  }
  :is(.info-panel, .chart, .analytics-ranking, .record-editor, .record-import,
      .record-audit, .record-probe, .scenario-detail, .statistics-scope, .zone-settings) {
    padding: 16px;
  }
  .metrics .panel { padding: 14px; }
  .query-dialog { padding: 16px; }
  .analytics-ranking .toolbar { align-items: flex-end; }
  .toolbar .search-label { flex-basis: 100%; min-width: 0; }
  .program-traffic-controls .search-label { flex-basis: 100%; }
  .dig-result button { font-size: 12px; }
}

@media (max-width: 650px) {
  .toolbar .grow, .toolbar .search-label { flex-basis: 100%; min-width: 0; }
  .toolbar > .muted { margin: 0; }
}

/* A field includes its label; sibling actions align to the input, not its height. */
.toolbar > button,
.toolbar > .view-switch {
  align-self: flex-end;
  flex-shrink: 0;
}

.code-view-tools > button {
  padding: 7px 12px;
}

.pagination {
  font-size: 12px;
  line-height: 20px;
}

.pagination > span,
.pagination label {
  white-space: nowrap;
}

.pagination label {
  font-size: 12px;
}

.section-head .refresh-tools {
  gap: 8px;
}

@media (max-width: 650px) {
  .pagination > span { white-space: normal; }
}

.scenario-detail-host { scroll-margin-top: 16px; }

/* Navigation and inline links are not bordered action buttons. */
:is(.scenario-taxonomy button, .code-tree-toggle, .distribution-row,
    .rank-button, .analytics-extra-metrics .metric-link, .detail-tabs button,
    .dig-history-link) {
  border: 0;
  box-shadow: none;
}

:is(.scenario-taxonomy button, .code-tree-toggle, .distribution-row,
    .rank-button, .analytics-extra-metrics .metric-link, .detail-tabs button,
    .dig-history-link):hover:not(:disabled) {
  border: 0;
  background: #edf5f2;
}

.scenario-taxonomy button {
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
}

.scenario-taxonomy button.active,
.scenario-taxonomy button.active:hover:not(:disabled) {
  background: #e5f5ee;
  color: #126d54;
}

.scenario-taxonomy button small {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.detail-tabs button.active,
.detail-tabs button[aria-selected="true"] {
  background: #e5f5ee;
  color: #14765c;
}

[data-static-section]>.static-section-title{font-size:13px;font-weight:600;line-height:1.6;margin:18px 0 12px;color:var(--text-secondary)}:is(.process-history,.scenario-batch,.scenario-capabilities)[data-static-section]>.static-section-title{padding:18px 22px;margin:0;border-bottom:1px solid #edf1f2}.history-dialog [data-static-section]{margin-top:20px}.packet-text[data-static-section],.packet-hex[data-static-section]{margin-top:20px}.program-accounting-notes>.static-section-title{cursor:default}

.dig-history > .query-filters { margin: 0 0 20px; }
