/* Shared UI components — matches training-map (@apply expanded for static CDN) */

:root {
  --tt-control-h: 2.5rem;
  --tt-control-px: 1rem;
  --tt-control-radius: 0.5rem;
  --tt-control-fs: 0.875rem;
}

.tt-page-card {
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
  background-color: var(--tt-card);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.tt-section-panel {
  border-radius: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
  background-color: var(--tt-card);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .tt-section-panel {
    padding: 1.5rem;
  }
}

.tt-section-eyebrow {
  margin: 0 0 0.25rem;
  font-size: var(--tt-text-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tt-accent);
}

.tt-section-title {
  margin: 0;
  font-size: var(--tt-text-lg);
  font-weight: 700;
  line-height: 1.3;
  color: var(--tt-heading);
}

.tt-section-desc {
  margin: 0.25rem 0 0;
  font-size: var(--tt-text-sm);
  line-height: 1.45;
  color: var(--tt-cell);
}

.tt-type-caption {
  font-size: var(--tt-text-xs);
  color: var(--tt-cell);
}

.tt-text-muted {
  color: var(--tt-muted);
}

.tt-text-subtle {
  color: var(--tt-subtle);
}

/* ── Uniform controls (buttons + inputs) ─────────────────────────────────── */

.tt-btn-primary,
.tt-btn-secondary,
.tt-btn-ghost,
.tt-btn-danger,
.tt-btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: var(--tt-control-h);
  height: var(--tt-control-h);
  padding: 0 var(--tt-control-px);
  border-radius: var(--tt-control-radius);
  font-family: inherit;
  font-size: var(--tt-control-fs);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.tt-btn-primary:disabled,
.tt-btn-secondary:disabled,
.tt-btn-ghost:disabled,
.tt-btn-danger:disabled,
.tt-btn-success:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tt-btn-primary {
  border: none;
  color: #ffffff;
  background-color: var(--tt-accent);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.tt-btn-primary:hover:not(:disabled) {
  background-color: var(--tt-accent-hover);
}

.tt-btn-secondary {
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
  background-color: var(--tt-card);
  color: var(--tt-heading);
}

.tt-btn-secondary:hover:not(:disabled) {
  background-color: var(--tt-elevated-hover);
}

.tt-btn-ghost {
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
  background-color: transparent;
  color: var(--tt-cell);
}

.tt-btn-ghost:hover:not(:disabled) {
  color: var(--tt-heading);
  background-color: var(--tt-elevated-hover);
  border-color: color-mix(in srgb, var(--tt-accent) 30%, transparent);
}

.tt-btn-danger {
  border: 1px solid #b91c1c;
  color: #ffffff;
  background-color: #dc2626;
}

.tt-btn-danger:hover:not(:disabled) {
  background-color: #b91c1c;
}

.tt-btn-success {
  border: none;
  color: #ffffff;
  background: var(--tt-success);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--tt-success) 20%, transparent);
}

.tt-btn-success:hover:not(:disabled) {
  background: var(--tt-success-hover);
}

.tt-btn-icon {
  width: var(--tt-control-h);
  min-width: var(--tt-control-h);
  padding: 0;
}

.tt-btn-secondary--sm,
.tt-btn-ghost.tt-btn-secondary--sm {
  min-height: var(--tt-control-h);
  height: var(--tt-control-h);
  padding: 0 0.75rem;
  font-size: var(--tt-control-fs);
}

.tt-btn-icon.tt-btn-secondary--sm {
  width: var(--tt-control-h);
  min-width: var(--tt-control-h);
  padding: 0;
}

.tt-input,
select.tt-input {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--tt-control-h);
  height: var(--tt-control-h);
  border-radius: var(--tt-control-radius);
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
  background-color: var(--tt-card);
  color: var(--tt-heading);
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: var(--tt-control-fs);
  line-height: 1.25;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tt-input::placeholder {
  color: var(--tt-cell);
  opacity: 0.65;
}

.tt-input:focus,
select.tt-input:focus {
  border-color: color-mix(in srgb, var(--tt-accent) 50%, var(--tt-border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tt-accent) 30%, transparent);
}

.tt-input:disabled,
select.tt-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tt-workspace-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.tt-workspace-inner {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* —— Compare workflow stepper (TransportationTransfer pattern) —— */
.tt-compare-workflow {
  padding-bottom: 2rem;
}

.tt-stepper__title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tt-heading);
}

.tt-stepper__track,
.tt-stepper__labels {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tt-stepper__track {
  display: grid;
  grid-template-columns: repeat(var(--tt-stepper-count, 3), minmax(0, 1fr));
  align-items: center;
  width: 100%;
  gap: 0;
}

.tt-stepper__track-item {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.tt-stepper__track-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--tt-border);
  transform: translateY(-50%);
  pointer-events: none;
  transition: background 0.2s ease;
}

.tt-stepper__track-item--segment-filled:not(:last-child)::after {
  background: var(--tt-accent);
}

.tt-stepper__node {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 9999px;
  transition: transform 0.15s ease;
}

.tt-stepper__node:hover:not(:disabled) {
  transform: scale(1.04);
}

.tt-stepper__node:disabled {
  cursor: default;
  opacity: 0.5;
}

.tt-stepper__indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 2px solid var(--tt-border);
  background: var(--tt-card);
  color: var(--tt-cell);
  font-size: 0.8125rem;
  font-weight: 700;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.tt-stepper__item--current .tt-stepper__indicator {
  border-color: var(--tt-accent);
  background: var(--tt-accent);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tt-accent) 22%, transparent);
}

.tt-stepper__item--complete .tt-stepper__indicator {
  border-color: var(--tt-accent);
  background: color-mix(in srgb, var(--tt-accent) 12%, var(--tt-card));
  color: var(--tt-accent);
}

.tt-stepper__labels {
  display: grid;
  grid-template-columns: repeat(var(--tt-stepper-count, 3), minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
}

.tt-stepper__label-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
  text-align: center;
}

.tt-stepper__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tt-heading);
  line-height: 1.2;
}

.tt-stepper__item--locked .tt-stepper__label {
  color: var(--tt-cell);
}

.tt-stepper__desc {
  max-width: 11rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tt-cell);
  line-height: 1.35;
}

.tt-stepper__item--locked .tt-stepper__desc {
  opacity: 0.65;
}

.tt-step-panel {
  margin-top: 1.5rem;
}

.tt-step-panel__header {
  padding: 1.5rem 1.5rem 0;
}

.tt-step-panel__heading {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--tt-heading);
}

.tt-step-panel__heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tt-accent);
}

.tt-step-panel__subheading {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--tt-cell);
}

.tt-step-panel__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.tt-step-panel__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--tt-border);
}

.tt-step-panel__footer--last {
  justify-content: space-between;
}

.tt-step-pane.tt-hidden {
  display: none !important;
}

/* Toolbars */
.tt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.tt-card-body {
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .tt-card-body {
    padding: 1.5rem;
  }
}

.tt-options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding-top: 1rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--tt-border);
}

.tt-options-bar__checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex: 1 1 auto;
}

.tt-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tt-control-h);
  cursor: pointer;
  user-select: none;
  font-size: var(--tt-control-fs);
  color: var(--tt-heading);
}

/* Segmented tabs (results) */
.tt-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: var(--tt-elevated);
  border: 1px solid color-mix(in srgb, var(--tt-border) 75%, transparent);
}

.tt-seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: calc(var(--tt-control-h) - 0.25rem);
  height: calc(var(--tt-control-h) - 0.25rem);
  padding: 0 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--tt-cell);
  font-family: inherit;
  font-size: var(--tt-control-fs);
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tt-seg__btn:hover {
  color: var(--tt-heading);
  background: color-mix(in srgb, var(--tt-card) 70%, transparent);
}

.tt-seg__btn--active {
  background: var(--tt-card);
  color: var(--tt-heading);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.tt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  background: var(--tt-accent-muted);
  color: var(--tt-accent-muted-fg);
}

.tt-chip--sky {
  background: color-mix(in srgb, #0284c7 14%, transparent);
  color: #0369a1;
}

.tt-chip--indigo {
  background: color-mix(in srgb, #6366f1 14%, transparent);
  color: #4338ca;
}

.tt-chip--emerald {
  background: color-mix(in srgb, var(--tt-success) 14%, transparent);
  color: var(--tt-success);
}

[data-theme="dark"] .tt-chip--sky {
  color: #7dd3fc;
}

[data-theme="dark"] .tt-chip--indigo {
  color: #a5b4fc;
}

/* Metric tiles */
.tt-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .tt-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }
}

.tt-metric-card {
  border-radius: 1rem;
  border: 1px solid var(--tt-border);
  background: var(--tt-card);
  padding: 1rem 1.125rem;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.04),
    0 8px 24px -12px rgb(0 0 0 / 0.1);
  min-width: 0;
}

.tt-metric-card__label {
  margin: 0;
  font-size: var(--tt-text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tt-cell);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-metric-card__value {
  margin: 0.35rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--tt-heading);
}

.tt-metric-card__value--accent {
  color: var(--tt-accent);
}

.tt-metric-card__value--success {
  color: var(--tt-success);
}

.tt-metric-card__value--warning {
  color: var(--tt-metric-warn);
}

/* Key column highlight in tables */
.tt-key-col {
  background-color: color-mix(in srgb, var(--tt-accent) 10%, var(--tt-card)) !important;
  color: var(--tt-accent-muted-fg);
  font-weight: 600;
}

tbody .tt-key-col {
  color: var(--tt-heading);
  font-weight: 500;
  background-color: color-mix(in srgb, var(--tt-accent) 6%, var(--tt-card)) !important;
}

/* Tools drop zones — 2-column variant of training-map dropzone */
.tt-dropzone-layout--dual {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .tt-dropzone-layout--dual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.tt-file-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--tt-control-h);
  padding: 0.75rem 0.875rem;
  border-radius: var(--tt-control-radius);
  border: 1px solid color-mix(in srgb, var(--tt-accent) 22%, var(--tt-border));
  background: color-mix(in srgb, var(--tt-accent) 6%, var(--tt-card));
}

.tt-file-meta__icon {
  color: var(--tt-accent);
  flex-shrink: 0;
}

.tt-key-pair {
  border-radius: 0.75rem;
  border: 1px solid var(--tt-border);
  background: color-mix(in srgb, var(--tt-elevated) 65%, var(--tt-card));
  padding: 1rem 1.125rem;
}

.tt-key-pair__head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.875rem;
  min-height: var(--tt-control-h);
}

.tt-key-pair .key-pair-remove {
  color: var(--tt-cell);
  margin-left: auto;
}

.tt-key-pair .key-pair-remove:hover:not(:disabled) {
  color: var(--tt-danger);
  border-color: color-mix(in srgb, var(--tt-danger) 35%, var(--tt-border));
  background: color-mix(in srgb, var(--tt-danger) 8%, var(--tt-card));
}

.tt-key-pair__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: var(--tt-heading);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.tt-key-pair__title {
  font-size: var(--tt-control-fs);
  font-weight: 600;
  color: var(--tt-heading);
}

.tt-count-stepper {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--tt-control-h);
  min-height: var(--tt-control-h);
  padding: 0.25rem;
  border-radius: var(--tt-control-radius);
  border: 1px solid var(--tt-border);
  background: var(--tt-elevated);
}

.tt-count-stepper__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--tt-cell);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.tt-count-stepper__btn:hover:not(:disabled) {
  background: var(--tt-card);
  color: var(--tt-heading);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

.tt-count-stepper__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tt-count-stepper__value {
  min-width: 2rem;
  text-align: center;
  font-size: var(--tt-control-fs);
  font-weight: 600;
  color: var(--tt-heading);
}

.tt-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tt-success) 35%, var(--tt-border));
  background: color-mix(in srgb, var(--tt-success) 10%, var(--tt-card));
  color: var(--tt-success);
  font-size: 0.75rem;
  font-weight: 600;
}

.tt-privacy-pill__dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: var(--tt-success);
}

.tt-empty-state {
  padding: 3.5rem 1.25rem;
  text-align: center;
}

.tt-empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.75rem;
  border-radius: 1rem;
  background: var(--tt-elevated);
  color: var(--tt-cell);
}

.tt-config-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.tt-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tt-heading) 35%, transparent);
  backdrop-filter: blur(2px);
}

.tt-loading-overlay.show {
  display: flex;
}

.tt-loading-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--tt-border);
  background: var(--tt-card);
  box-shadow: var(--tt-shadow);
  color: var(--tt-heading);
  font-size: var(--tt-control-fs);
  font-weight: 600;
  min-height: 3.25rem;
}

.tt-hidden {
  display: none !important;
}

/* Results preview */
.tt-results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.tt-results-toolbar__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  min-width: 0;
}

.tt-search-field {
  position: relative;
  flex: 1 1 auto;
  width: 14rem;
  max-width: 16rem;
  min-width: 8rem;
}

.tt-btn-export {
  flex-shrink: 0;
}

.tt-btn-export__short {
  display: none;
}

.tt-search-field__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tt-cell);
  font-size: 0.75rem;
  pointer-events: none;
}

.tt-search-field .tt-input {
  padding-left: 2.25rem;
}

.tt-preview-status {
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid var(--tt-border);
  background: var(--tt-elevated);
  font-size: var(--tt-text-xs);
  color: var(--tt-cell);
}

.tt-preview-scroll {
  max-height: 28rem;
  overflow: auto;
}

.tt-preview-scroll .tt-rpt-table-wrap {
  padding-top: 0.5rem;
}

.tt-sidebar-nav-item {
  text-decoration: none;
  font-family: var(--font-inter), ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tt-sidebar-nav-label,
.tt-sidebar-profile-name,
.tt-sidebar-nav-heading,
.tt-sidebar-brand__title {
  font-family: var(--font-inter), ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tt-sidebar-nav-icon svg {
  display: block;
}

.tt-sidebar-profile-trigger--collapsed .tt-sidebar-profile-name {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Dual upload: neutralize 3-col dropzone span from source CSS */
.tt-dropzone-layout--dual .tt-dropzone--main {
  grid-column: auto;
  min-height: 10.5rem;
  padding: 1.75rem 1.25rem;
}

.tt-rpt-card-header {
  gap: 0.75rem 1rem;
}

@media (max-width: 767px) {
  .tt-rpt-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .tt-rpt-card-actions {
    width: 100%;
  }

  .tt-rpt-card-actions .tt-btn-secondary,
  .tt-rpt-card-actions .tt-btn-primary,
  .tt-rpt-card-actions .tt-btn-success {
    flex: 1 1 auto;
  }

  .tt-results-toolbar__actions {
    width: 100%;
    margin-left: 0;
  }

  .tt-search-field {
    width: auto;
    max-width: none;
    min-width: 0;
  }

  .tt-btn-export__full {
    display: none;
  }

  .tt-btn-export__short {
    display: inline;
  }
}
