* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #ff5c01;
  --primary-hover: #e54d00;
  --primary-light: #fff4ef;
  --secondary: #1e293b;
  --secondary-hover: #0f172a;
  --success: #10b981;
  --background: #faf8f5;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow: rgba(15, 23, 42, 0.08);
  --shadow-hover: rgba(15, 23, 42, 0.12);
  --accent: #0d9488;
  --accent-light: #e6fffa;
  --teal: #0d9488;
  --teal-dark: #0f766e;
}

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap");

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  background: var(--background);
  background-image: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.08) 1px,
    transparent 1px
  );
  background-size: 20px 20px;
  background-position: 0 0;
  color: var(--text);
  line-height: 1.5;
  padding: 16px;
  font-weight: 400;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px 24px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
}

header h1 {
  font-size: 2.25rem;
  color: var(--secondary);
  margin-bottom: 10px;
  font-weight: 700;
  font-family: "Inter", sans-serif;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  font-weight: 400;
  line-height: 1.6;
}

.header-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.header-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.header-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.link-separator {
  color: var(--text-light);
  font-size: 0.9rem;
}

.upload-section {
  margin-bottom: 30px;
}

.rename-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.rename-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rename-field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.rename-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: all 0.2s ease;
  font-family: inherit;
}

.rename-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.rename-input::placeholder {
  color: var(--text-light);
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area.dragover {
  border-color: var(--primary);
  background: var(--accent-light);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--primary);
  margin: 0 auto 12px;
}

.upload-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-info {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--surface);
  border-radius: 10px;
  margin-top: 15px;
  box-shadow: 0 2px 4px var(--shadow);
  border: 1px solid var(--border);
}

.current-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.current-post-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.current-post-name {
  font-weight: 500;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 4px;
}

.download-button-container {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  width: 100%;
  flex-shrink: 0;
  display: block;
  box-sizing: border-box;
}

.file-info .download-button-container button {
  width: auto;
  min-width: 200px;
}

.content {
  background: var(--surface);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px var(--shadow);
  border: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.tab:hover {
  color: var(--primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-header {
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.4rem;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 700;
}

.section-description {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-box {
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: var(--surface);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.properties-grid {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 30px;
}

.property-group-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.property-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}

.property-group-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  font-family: "Inter", sans-serif;
  letter-spacing: -0.01em;
}

.property-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.property-group-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.property-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  transition: all 0.2s ease;
}

.property-card:hover {
  box-shadow: 0 2px 6px var(--shadow);
  border-color: var(--primary);
}

.property-header {
  margin-bottom: 12px;
}

.property-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-family: "Inter", sans-serif;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.property-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.property-scope-warning {
  font-size: 0.75rem;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  padding: 6px 10px;
  margin-top: 8px;
  line-height: 1.4;
}

.property-scope-label {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.property-scope-label-machine {
  color: #059669;
  background: #d1fae5;
}

.property-scope-label-operation {
  color: #7c3aed;
  background: #ede9fe;
}

.property-group {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.property-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.property-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Custom Tooltip Styles */
[data-tooltip],
.has-tooltip {
  position: relative;
  cursor: help;
}

/* Dynamic tooltip for elements with newlines */
.dynamic-tooltip {
  position: fixed;
  padding: 12px 16px;
  background-color: #1e293b;
  color: #faf8f5;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  max-width: 350px;
  min-width: 220px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.1s ease-out forwards;
  word-wrap: break-word;
}

.dynamic-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #1e293b;
  z-index: 10001;
  pointer-events: none;
}

/* Ensure tooltips can escape overflow containers */
.setting-section,
.setting-section-body,
.property-card {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 12px 16px;
  background-color: #1e293b;
  color: #faf8f5;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-width: 350px;
  min-width: 220px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.1s ease-out forwards;
  word-wrap: break-word;
}

[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 0px;
  border: 7px solid transparent;
  border-top-color: #1e293b;
  z-index: 1001;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.1s ease-out forwards;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Ensure tooltips can escape overflow containers - append to body */
.setting-section,
.setting-section-body,
.property-card {
  position: relative;
  /* Keep overflow hidden for collapse animations, but tooltips are now in body */
}

/* Hide native tooltip when custom tooltip is present */
[data-tooltip][title] {
  position: relative;
}

[data-tooltip][title]:hover {
  position: relative;
}

/* Toggle Switch Styles */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: all 0.3s ease;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.toggle-input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Property toggle specific */
.property-toggle + .toggle-slider {
  margin-top: 0;
}

.settings-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.setting-section {
  width: 100%;
}

.setting-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.setting-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}

/* Sections with headers (collapsible) should have no padding on the section itself */
.setting-section-header {
  padding: 0;
}

/* For sections with headers, remove section padding */
.setting-section:has(.setting-section-header) {
  padding: 0;
}

.setting-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.setting-section-header:hover {
  background-color: var(--background);
}

.setting-section-header:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.setting-section-toggle-icon {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
  display: inline-block;
}

.setting-section-collapsed .setting-section-toggle-icon {
  transform: rotate(-90deg);
}

.setting-section-body {
  padding: 16px;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
  overflow: hidden;
  max-height: 5000px; /* Large enough for most content */
}

.setting-section-collapsed .setting-section-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
}

.setting-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  padding: 0;
  border: none;
}

.setting-section-description {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.setting-section-description a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.setting-section-description a:hover {
  border-bottom-color: var(--accent);
}

.setting-item {
  margin-bottom: 12px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-label {
  display: block;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.setting-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  box-sizing: border-box;
  min-width: 0; /* Allow shrinking */
}

.setting-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.setting-input[type="number"] {
  font-family: inherit;
}

.setting-input.setting-select {
  font-family: inherit;
  cursor: pointer;
}

.setting-input.setting-textarea {
  resize: vertical;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  min-height: 60px;
}

.tool-list-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.tool-list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.tool-list-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tool-list-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.tool-list-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.tool-list-card-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-list-flags {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-list-flags .toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.tool-list-criteria-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.tool-list-criteria-option {
  display: flex;
  align-items: center;
}

.tool-list-criteria-option .toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.tool-list-criteria-toggles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.tool-list-criteria-toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.tool-list-criteria-toggle-item .toggle-label {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.tool-list-criteria-toggle-item .toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.tool-list-criteria-toggle-item .tool-list-criteria-toggle {
  opacity: 0;
  width: 0;
  height: 0;
}

.tool-list-criteria-toggle-item .toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: all 0.3s ease;
  border-radius: 24px;
}

.tool-list-criteria-toggle-item .toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-list-criteria-toggle-item
  .tool-list-criteria-toggle:checked
  + .toggle-slider {
  background: var(--primary);
}

.tool-list-criteria-toggle-item
  .tool-list-criteria-toggle:checked
  + .toggle-slider:before {
  transform: translateX(20px);
}

.tool-list-criteria-toggle-item
  .tool-list-criteria-toggle:focus
  + .toggle-slider {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.settings-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.settings-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.settings-card-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 5px;
  font-style: italic;
}

.nested-setting {
  margin-left: 16px;
  margin-top: 8px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.nested-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* Coolant Section Styles */
.coolant-section {
  background: var(--surface);
}

.coolant-controls {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.single-line-coolant-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coolants-list {
  margin-top: 20px;
}

.coolants-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
}

.coolants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.coolant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

/* Subprogram Section Styles */
.subprogram-section {
  background: var(--surface);
}

.subprogram-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.subprogram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.subprogram-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.subprogram-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.subprogram-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.subprogram-card-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  font-style: italic;
}

.subprogram-card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subprogram-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subprogram-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.subprogram-input,
.subprogram-block-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  transition: all 0.2s ease;
}

.subprogram-input:focus,
.subprogram-block-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.coolant-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px var(--shadow);
}

/* Subprogram Section Styles */
.subprogram-section {
  background: var(--surface);
}

.subprogram-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.subprogram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.subprogram-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.subprogram-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.subprogram-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.subprogram-card-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  font-style: italic;
}

.subprogram-card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subprogram-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subprogram-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.subprogram-input,
.subprogram-block-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  transition: all 0.2s ease;
}

.subprogram-input:focus,
.subprogram-block-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.coolant-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.coolant-card-header h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.coolant-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
}

.coolant-card-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coolant-sub-settings {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  max-width: 100%;
}

@media (min-width: 600px) {
  .coolant-sub-settings {
    grid-template-columns: repeat(3, 1fr);
  }
}

.coolant-sub-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}

.coolant-sub-card-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.coolant-sub-card-header h6 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  text-transform: capitalize;
}

.coolant-sub-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coolant-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.coolant-field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.coolant-input {
  width: 100%;
  padding: 8px 35px 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  transition: border-color 0.3s ease;
}

.coolant-input:focus {
  outline: none;
  border-color: var(--primary);
}

.coolant-input::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn-remove-coolant {
  position: absolute;
  right: 8px;
  top: 50%;
  background: var(--secondary);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.btn-remove-coolant:hover {
  opacity: 1;
  background: var(--secondary-hover);
  transform: scale(1.1);
}

/* Precise Unit Input */
.precise-unit-input {
  display: flex;
  gap: 8px;
}

.precise-unit-value {
  flex: 1;
}

.precise-unit-select {
  width: 100px;
  flex-shrink: 0;
}

/* Retract Array Inputs */
.retract-axes,
.retract-methods {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.axis-checkbox,
.method-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
}

.axis-checkbox:hover,
.method-checkbox:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.axis-checkbox input[type="checkbox"]:checked + span,
.method-checkbox input[type="checkbox"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.axis-checkbox input[type="checkbox"]:checked ~ *,
.method-checkbox input[type="checkbox"]:checked ~ * {
  border-color: var(--primary);
}

.axis-checkbox input[type="checkbox"]:checked,
.method-checkbox input[type="checkbox"]:checked {
  accent-color: var(--primary);
}

/* HomeXY inline axes toggles */
.homexy-axes-inline {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
}

.axis-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.axis-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  min-width: 16px;
}

.actions {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1.5px solid var(--border);
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px var(--shadow);
  font-family: "Inter", sans-serif;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(255, 92, 1, 0.3);
  transform: translateY(-1px);
  background: var(--primary-hover);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.hidden {
  display: none !important;
}

/* Probing Section Styles */
.probing-section {
  background: var(--surface);
}

.probing-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.probing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.probing-card-wide {
  grid-column: 1 / -1;
}

.probing-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.probing-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.probing-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.probing-card-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.probing-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.probing-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.probing-input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: "Monaco", "Menlo", "Courier New", monospace;
  transition: all 0.2s ease;
}

.probing-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Retract Section Styles */
.retract-section {
  background: var(--surface);
}

.retract-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.retract-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.2s ease;
}

.retract-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.retract-card-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.retract-card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.retract-card-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.retract-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.retract-field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.1rem;
}

.settings-type-group {
  margin-bottom: 24px;
}

.settings-type-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-type-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

@media (max-width: 768px) {
  .property-group-content {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 2rem;
  }

  .content {
    padding: 20px;
  }

  .property-group-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .coolants-grid {
    grid-template-columns: 1fr;
  }
}

/* Saved notification */
.saved-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--success);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 1000;
}

.saved-notification.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.saved-icon {
  width: 20px;
  height: 20px;
  stroke-width: 3;
}

/* Liability Confirmation Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-warning-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0 0 16px;
  color: var(--text);
  line-height: 1.6;
  font-size: 0.95rem;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-body strong {
  color: var(--primary);
  font-weight: 600;
}

.modal-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer .btn-secondary,
.modal-footer .btn-primary {
  min-width: 120px;
}

@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 20px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn-secondary,
  .modal-footer .btn-primary {
    width: 100%;
  }
}
