.diagnostic-tools-section {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.diagnostic-tools-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.diagnostic-tools-heading h2,
.diagnostic-tools-heading p {
  margin: 0;
}

.diagnostic-tools-heading p {
  color: #9bb4c3;
}

.diagnostic-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.diagnostic-tool-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 17px;
  border: 1px solid rgba(150, 195, 222, .18);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(17, 50, 70, .9), rgba(8, 28, 42, .96));
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.diagnostic-tool-card:hover,
.diagnostic-tool-card:focus-visible {
  border-color: rgba(42, 174, 255, .58);
  transform: translateY(-1px);
}

.diagnostic-tool-card:focus-visible {
  outline: 2px solid #2aaeff;
  outline-offset: 2px;
}

.diagnostic-tool-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: rgba(42, 174, 255, .12);
  color: #81d5ff;
  font-size: 1.25rem;
  font-weight: 950;
}

.diagnostic-tool-card span:nth-child(2) {
  display: grid;
  gap: 4px;
}

.diagnostic-tool-card small {
  color: #9db7c7;
  font-size: .78rem;
  line-height: 1.35;
}

.diagnostic-tool-card .card-navigation-indicator {
  color: #80d7ff;
  font-size: 1.25rem;
  font-weight: 900;
}

.tool-page,
.tool-loading,
.tool-error {
  width: 100%;
}

.tool-page {
  display: grid;
  gap: 18px;
}

.tool-loading,
.tool-error {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(150, 195, 222, .18);
  border-radius: 10px;
  background: rgba(8, 28, 42, .82);
  text-align: center;
}

.tool-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(150, 195, 222, .18);
  border-radius: 10px;
  background: linear-gradient(125deg, rgba(17, 56, 80, .96), rgba(8, 28, 42, .96));
}

.tool-page-heading h1 {
  margin: 5px 0 8px;
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
}

.tool-page-heading p {
  max-width: 720px;
  margin: 0;
  color: #b8cfdd;
}

.tool-eyebrow {
  color: #78d0ff;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  align-items: start;
  gap: 14px;
}

.tool-form,
.tool-result {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: clamp(17px, 2.5vw, 24px);
  border: 1px solid rgba(150, 195, 222, .17);
  border-radius: 10px;
  background: rgba(8, 27, 40, .9);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .16);
}

.tool-form-heading h2,
.tool-form-heading p {
  margin: 0;
}

.tool-form-heading h2 {
  color: #fff;
  font-size: 1.12rem;
}

.tool-form-heading p {
  margin-top: 4px;
  color: #8faab9;
  font-size: .82rem;
}

.tool-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #dcecf5;
  font-size: .79rem;
  font-weight: 850;
}

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

.tool-field select,
.tool-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid rgba(150, 195, 222, .24);
  border-radius: 7px;
  background: #071722;
  color: #fff;
}

.tool-field select {
  padding: 9px 10px;
}

.tool-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(150, 195, 222, .24);
  border-radius: 7px;
  background: #071722;
}

.tool-input-wrap input {
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
}

.tool-input-wrap small {
  padding: 0 10px;
  color: #8eabba;
  font-size: .75rem;
  white-space: nowrap;
}

.tool-field select:focus-visible,
.tool-field input:focus-visible,
.tool-submit:focus-visible,
.tool-calculation-detail summary:focus-visible {
  outline: 2px solid #2aaeff;
  outline-offset: 2px;
}

.tool-submit {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid #1fa8f5;
  border-radius: 7px;
  background: linear-gradient(145deg, #20acf9, #147db6);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.tool-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-form-actions .tool-submit,
.tool-reset {
  flex: 1 1 0;
}

.tool-reset {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(150, 195, 222, .28);
  border-radius: 7px;
  background: rgba(16, 48, 67, .72);
  color: #dcecf5;
  font-weight: 850;
  cursor: pointer;
}

.tool-reset:hover {
  border-color: rgba(42, 174, 255, .48);
  background: rgba(24, 67, 91, .82);
}

.tool-reset:focus-visible {
  outline: 2px solid #2aaeff;
  outline-offset: 2px;
}

.tool-result-main b {
  color: #b9d7e7;
  font-size: .9rem;
}

.tool-errors:empty {
  display: none;
}

.tool-errors {
  padding: 12px 14px;
  border: 1px solid rgba(255, 113, 113, .3);
  border-radius: 7px;
  background: rgba(108, 24, 30, .25);
  color: #ffd0d0;
  font-size: .82rem;
}

.tool-errors ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.tool-result {
  position: sticky;
  top: 74px;
}

.tool-result-main {
  display: grid;
  gap: 7px;
  padding: 17px;
  border: 1px solid rgba(51, 198, 157, .3);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(26, 99, 80, .46), rgba(12, 49, 48, .52));
}

.tool-result-main span {
  color: #bce9d9;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.tool-result-main strong {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}

.tool-result-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.tool-result-facts > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(150, 195, 222, .12);
  border-radius: 7px;
  background: rgba(16, 43, 59, .64);
}

.tool-result-facts dt {
  color: #819cac;
  font-size: .67rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tool-result-facts dd {
  margin: 0;
  color: #fff;
  font-weight: 900;
}

.tool-result-note,
.tool-warning {
  margin: 0;
  padding: 11px 12px;
  border-left: 3px solid #ff9e35;
  background: rgba(255, 158, 53, .07);
  color: #d8e5ec;
  font-size: .8rem;
  line-height: 1.45;
}

.tool-warning {
  border-left-color: #ffc064;
  color: #ffdbab;
}

.tool-result-empty {
  display: grid;
  min-height: 260px;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.tool-result-empty h2,
.tool-result-empty p {
  margin: 0;
}

.tool-calculation-detail {
  border-top: 1px solid rgba(150, 195, 222, .14);
  padding-top: 11px;
}

.tool-calculation-detail summary {
  color: #8ed8ff;
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
}

.tool-calculation-detail div {
  padding-top: 8px;
  color: #9fb7c5;
  font-size: .79rem;
}

.tool-calculation-detail p {
  margin: 5px 0;
}

.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;
}

.holding-study-settings {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(180px, .45fr) minmax(180px, .45fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(150, 195, 222, .17);
  border-radius: 9px;
  background: rgba(8, 27, 40, .9);
}

.holding-study-settings h2,
.holding-study-settings p,
.holding-table-heading h2,
.holding-table-heading p {
  margin: 0;
}

.holding-study-settings h2,
.holding-table-heading h2 {
  color: #fff;
  font-size: 1.05rem;
}

.holding-study-settings p,
.holding-table-heading p {
  margin-top: 3px;
  color: #8faab9;
  font-size: .79rem;
}

.holding-new-study,
.holding-reset,
.holding-cancel-edit,
.holding-duplicate button:not(.tool-submit),
.holding-row-actions button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(150, 195, 222, .22);
  border-radius: 7px;
  background: rgba(17, 45, 63, .8);
  color: #dcecf5;
  font-weight: 800;
  cursor: pointer;
}

.holding-new-study:hover,
.holding-reset:hover,
.holding-cancel-edit:hover,
.holding-row-actions button:hover {
  border-color: rgba(42, 174, 255, .55);
  color: #fff;
}

.holding-workspace {
  display: grid;
  grid-template-columns: minmax(300px, .68fr) minmax(0, 1.32fr);
  align-items: start;
  gap: 14px;
}

.holding-entry-panel,
.holding-analysis-panel,
.holding-table-panel {
  display: grid;
  gap: 15px;
  min-width: 0;
  padding: clamp(16px, 2.3vw, 22px);
  border: 1px solid rgba(150, 195, 222, .17);
  border-radius: 10px;
  background: rgba(8, 27, 40, .9);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
}

.holding-entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.holding-entry-actions,
.holding-row-actions,
.holding-duplicate > div,
.holding-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.holding-entry-actions,
.holding-form-error {
  grid-column: 1 / -1;
}

.holding-entry-actions .tool-submit {
  flex: 1;
}

.holding-form-error:empty {
  display: none;
}

.holding-form-error {
  padding: 10px 12px;
  border: 1px solid rgba(255, 113, 113, .28);
  border-radius: 7px;
  background: rgba(108, 24, 30, .24);
  color: #ffd0d0;
  font-size: .8rem;
}

.holding-duplicate[hidden] {
  display: none;
}

.holding-duplicate {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(255, 158, 53, .3);
  border-radius: 8px;
  background: rgba(86, 53, 20, .28);
  color: #ffe0bc;
  font-size: .82rem;
}

.holding-duplicate p {
  margin: 0;
}

.holding-analysis-summary {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid rgba(42, 174, 255, .2);
  border-radius: 8px;
  background: rgba(17, 57, 78, .54);
}

.holding-analysis-summary strong {
  color: #fff;
  font-size: 1.05rem;
}

.holding-analysis-summary p,
.holding-analysis-summary small {
  margin: 0;
  color: #a9c2d0;
}

.holding-analysis-summary p {
  line-height: 1.45;
}

.holding-analysis-summary small {
  font-size: .73rem;
}

.holding-chart-wrap {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(150, 195, 222, .13);
  border-radius: 8px;
  background: #071722;
}

.holding-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 250px;
}

.holding-chart-wrap text {
  fill: #8da7b7;
  font-size: 11px;
}

.holding-chart-grid {
  stroke: rgba(150, 195, 222, .11);
  stroke-width: 1;
}

.holding-chart-axis {
  stroke: rgba(198, 224, 239, .55);
  stroke-width: 1.2;
}

.holding-chart-line {
  fill: none;
  stroke: #2aaeff;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.holding-chart-point {
  fill: #ffad55;
  stroke: #071722;
  stroke-width: 2;
}

.holding-confirmation {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #ff9e35;
  background: rgba(255, 158, 53, .07);
  color: #d8e5ec;
  font-size: .8rem;
}

.holding-table-scroll {
  min-width: 0;
  overflow-x: auto;
}

.holding-table-panel table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  color: #dcecf5;
  font-size: .82rem;
}

.holding-table-panel th,
.holding-table-panel td {
  padding: 10px;
  border-bottom: 1px solid rgba(150, 195, 222, .12);
  text-align: left;
  white-space: nowrap;
}

.holding-table-panel th {
  color: #83a4b5;
  font-size: .69rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.holding-row-actions {
  justify-content: flex-start;
}

.holding-row-actions button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: .75rem;
}

.holding-empty-row {
  padding: 25px !important;
  color: #8da6b5;
  text-align: center !important;
}

.holding-study-settings input:disabled {
  opacity: .64;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .tool-result {
    position: static;
  }

  .holding-study-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .holding-study-settings > div:first-child,
  .holding-new-study {
    grid-column: 1 / -1;
  }

  .holding-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .tools-tablist { width: 100%; }
  .tools-panel-heading { align-items: stretch; flex-direction: column; }
  .tools-panel-heading .primary-action { width: 100%; }
  .diagnostic-tools-heading,
  .tool-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .diagnostic-tools-grid,
  .tool-fields {
    grid-template-columns: 1fr;
  }

  .tool-field-wide {
    grid-column: auto;
  }

  .holding-study-settings,
  .holding-entry-form {
    grid-template-columns: 1fr;
  }

  .holding-study-settings > div:first-child,
  .holding-new-study,
  .holding-entry-actions,
  .holding-form-error {
    grid-column: auto;
  }

  .holding-table-heading,
  .holding-entry-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .holding-table-heading button,
  .holding-entry-actions button {
    width: 100%;
  }

  .diagnostic-tool-card {
    grid-template-columns: auto 1fr;
  }

  .diagnostic-tool-card .card-navigation-indicator {
    grid-column: 2;
  }
}

@media (max-width: 430px) {
  .tool-form,
  .tool-result {
    padding: 14px;
  }

  .tool-result-facts {
    grid-template-columns: 1fr;
  }

  .tool-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-form-actions > * {
    width: 100%;
  }
}
.tools-hub {
  display: grid;
  gap: 14px;
}

.tools-tablist {
  display: none;
  width: fit-content;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(150, 195, 222, .18);
  border-radius: 9px;
  background: rgba(7, 28, 42, .72);
}

@media (max-width: 1180px) {
  .tools-tablist { display: inline-grid; }
}

.tools-tab {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #9db7c7;
  font-weight: 850;
  cursor: pointer;
}

.tools-tab:hover { color: #dff3fc; }

.tools-tab.is-active {
  border-color: rgba(70, 200, 255, .42);
  background: rgba(31, 139, 192, .28);
  color: #fff;
}

.tools-tab:focus-visible {
  outline: 3px solid #79d4ff;
  outline-offset: 2px;
}

.tools-tabpanel {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgba(150, 195, 222, .16);
  border-radius: 10px;
  background: rgba(7, 27, 41, .58);
}

.tools-tabpanel[hidden] { display: none; }

.tools-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.tools-panel-heading h2,
.tools-panel-heading h1,
.tools-panel-heading p { margin: 0; }
.tools-panel-heading h1 { color: #fff; font-size: clamp(1.55rem, 3vw, 2.15rem); }
.tools-panel-heading p { margin-top: 4px; color: #9bb4c3; }
