/* LandAI Web App — Test Fit Editor (desktop & responsive) */

.test-fit-panel {
  position: fixed;
  left: 112px;
  bottom: 18px;
  z-index: 42;
  width: min(392px, calc(100vw - 132px));
  max-height: min(76vh, 660px);
  display: flex;
  flex-direction: column;
  background: #F7F5F0;
  color: #16181A;
  border: 1px solid #E2DDD4;
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(20, 23, 28, 0.22);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
}

.test-fit-panel.is-hidden { display: none !important; }
.test-fit-panel.is-minimized { max-height: none; }
.test-fit-panel.is-minimized .tf-body { display: none; }

.tf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #E2DDD4;
}

.tf-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tf-title-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #EEF3FE;
  color: #2E6BF0;
  flex: none;
}

.tf-name-input {
  border: 0;
  background: transparent;
  font: 600 14px/1.2 'Hanken Grotesk', sans-serif;
  color: #16181A;
  min-width: 0;
  width: 100%;
  outline: none;
}

.tf-name-input:focus {
  background: #F7F5F0;
  border-radius: 6px;
  padding: 2px 6px;
}

.tf-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.tf-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #E2DDD4;
  background: #fff;
  color: #16181A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease;
}

.tf-icon-btn:hover:not(:disabled) { background: #EFECE5; }
.tf-icon-btn:disabled { opacity: 0.35; cursor: default; }
.tf-icon-btn.is-active { background: #16181A; color: #fff; border-color: #16181A; }
.tf-icon-btn.is-locked { background: #F59E0B; color: #fff; border-color: #F59E0B; }

.tf-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
}

.tf-counter-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.tf-count {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tf-unit {
  font-size: 14px;
  font-weight: 600;
}

.tf-detail {
  font-size: 12px;
  color: #5F656D;
  margin-top: 3px;
}

.tf-hero-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.tf-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid #E2DDD4;
  background: #fff;
  color: #16181A;
  font: 600 12px/1 'Hanken Grotesk', sans-serif;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tf-btn:hover:not(:disabled) { background: #EFECE5; }
.tf-btn:disabled { opacity: 0.4; cursor: default; }
.tf-btn.is-primary { background: #16181A; color: #fff; border-color: #16181A; }
.tf-btn.is-primary:hover:not(:disabled) { background: #2D3136; }
.tf-btn.is-danger { background: #E5484D; color: #fff; border-color: #E5484D; }
.tf-btn.is-active { background: #2E6BF0; color: #fff; border-color: #2E6BF0; }

.tf-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.tf-metrics-strip {
  display: flex;
  flex: none;
  gap: 6px;
  overflow-x: auto;
  padding: 0 14px 10px;
  scrollbar-width: none;
}

.tf-metrics-strip::-webkit-scrollbar { display: none; }

.tf-metric-chip {
  flex: none;
  background: #fff;
  border: 1px solid #E2DDD4;
  border-radius: 10px;
  padding: 5px 9px;
}

.tf-metric-chip strong {
  display: block;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tf-metric-chip span {
  display: block;
  font-size: 10.5px;
  color: #5F656D;
}

.tf-mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0 14px 8px;
  padding: 3px;
  background: #EAE6DC;
  border-radius: 10px;
}

.tf-mode-btn {
  border: 0;
  background: transparent;
  color: #495057;
  font: 600 12px/1 'Hanken Grotesk', sans-serif;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
}

.tf-mode-btn.is-active {
  background: #fff;
  color: #16181A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tf-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px 8px;
  border-bottom: 1px solid #E2DDD4;
}

.tf-tab {
  flex: 1;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #E2DDD4;
  background: #fff;
  color: #495057;
  font: 600 12px/1 'Hanken Grotesk', sans-serif;
  cursor: pointer;
}

.tf-tab.is-active {
  background: #16181A;
  color: #fff;
  border-color: #16181A;
}

.tf-scroll {
  overflow-y: auto;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tf-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5F656D;
  margin-top: 2px;
}

.tf-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tf-field {
  background: #fff;
  border: 1px solid #E2DDD4;
  border-radius: 12px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tf-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  color: #5F656D;
}

.tf-field-head strong {
  color: #16181A;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.tf-field input[type="range"] {
  width: 100%;
  accent-color: #16181A;
  margin: 0;
}

.tf-toggle-row {
  background: #fff;
  border: 1px solid #E2DDD4;
  border-radius: 12px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tf-toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2E6BF0;
}

.tf-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #EAE6DC;
  padding: 3px;
  border-radius: 10px;
}

.tf-seg button {
  border: 0;
  background: transparent;
  height: 28px;
  border-radius: 8px;
  font: 600 12px/1 'Hanken Grotesk', sans-serif;
  color: #495057;
  cursor: pointer;
}

.tf-seg button.is-active {
  background: #fff;
  color: #16181A;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tf-shapes-add {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tf-card-item {
  background: #fff;
  border: 1px solid #E2DDD4;
  border-radius: 12px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tf-card-item.is-selected {
  border-color: #2E6BF0;
  box-shadow: 0 0 0 2px rgba(46, 107, 240, 0.14);
}

.tf-card-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tf-card-item-title {
  font-size: 13px;
  font-weight: 600;
}

.tf-card-item-sub {
  font-size: 11.5px;
  color: #5F656D;
}

.tf-locked-box {
  margin: 0 14px 12px;
  background: #FFFBEB;
  border: 1px solid #F59E0B;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tf-locked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #92400E;
}

.tf-lot-status-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.tf-error-note {
  margin: 0 14px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  font-size: 12px;
}

/* Floating Multi-Select Bar (top center) */
.tf-multiselect-bar {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 48;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #E2DDD4;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(20, 23, 28, 0.18);
  font-family: 'Hanken Grotesk', sans-serif;
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
}

.tf-multiselect-bar.is-hidden { display: none !important; }

.tf-ms-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #16181A;
  padding: 0 4px;
}

.tf-ms-sub {
  font-size: 11.5px;
  color: #5F656D;
}

/* Marquee drag-box */
.tf-marquee {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  background: rgba(46, 107, 240, 0.14);
  border: 1.5px dashed #2E6BF0;
  border-radius: 6px;
}

.tf-marquee.is-hidden { display: none !important; }

/* Right-click / tap handle context menu */
.tf-context-menu {
  position: fixed;
  z-index: 55;
  background: #fff;
  border: 1px solid #E2DDD4;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(20, 23, 28, 0.22);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  font-family: 'Hanken Grotesk', sans-serif;
}

.tf-context-menu.is-hidden { display: none !important; }

.tf-ctx-row {
  display: flex;
  gap: 4px;
}

.tf-ctx-btn {
  border: 0;
  background: transparent;
  color: #16181A;
  font: 600 12.5px/1.2 'Hanken Grotesk', sans-serif;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.tf-ctx-btn:hover:not(:disabled) { background: #F7F5F0; }
.tf-ctx-btn:disabled { opacity: 0.4; cursor: default; }
.tf-ctx-btn.is-danger { color: #E5484D; }
.tf-ctx-btn.is-active { background: #16181A; color: #fff; }

.tf-hint-footer {
  padding: 6px 14px 10px;
  font-size: 11px;
  color: #5F656D;
  border-top: 1px solid #ECE8DF;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 768px) {
  .test-fit-panel {
    left: 10px;
    right: 10px;
    bottom: 72px;
    width: auto;
    max-height: 56vh;
  }
}
