/* ============================================
   HORTIHUB — SHARED COMPONENTS & TOOL STYLES
   Requires theme.css (design tokens) to be loaded first.
   ============================================ */

/* ============================================
   AUTH MODAL (auth-modal.js)
   ============================================ */
#_auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: _modal-fade-in 0.2s ease;
}

@keyframes _modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

._auth-modal-card {
  background: var(--surface-elev);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: _modal-slide-up 0.25s ease;
}

@keyframes _modal-slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

._auth-modal-header {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  padding: 28px 28px 20px;
  text-align: center;
}

._auth-modal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

._auth-modal-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

._auth-modal-logo-icon svg {
  width: 18px;
  height: 18px;
}

._auth-modal-logo-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #fff;
  font-weight: 400;
}

._auth-modal-subtitle {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
}

._auth-tab-nav {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

._auth-tab-btn {
  flex: 1;
  padding: 13px;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-body);
}

._auth-tab-btn._auth-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

._auth-panel {
  display: none;
  padding: 24px 28px 28px;
}

._auth-panel._auth-panel-active {
  display: block;
}

._auth-field {
  margin-bottom: 16px;
}

._auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: var(--font-body);
}

._auth-field input[type="email"],
._auth-field input[type="password"] {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

._auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-12);
}

._auth-forgot-link {
  display: block;
  text-align: right;
  margin-top: 5px;
  background: none;
  border: none;
  color: var(--accent-mid);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  text-decoration: underline;
}
._auth-forgot-link:hover { color: var(--accent); }

._auth-back-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--accent-mid);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  font-family: var(--font-body);
  text-decoration: underline;
}
._auth-back-link:hover { color: var(--accent); }

._auth-submit-btn {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 4px;
}
._auth-submit-btn:hover { opacity: 0.9; }
._auth-submit-btn:active { transform: scale(0.99); }
._auth-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

._auth-message {
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  display: none;
  font-family: var(--font-body);
}
._auth-message--error   { display: block; background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border);  }
._auth-message--success { display: block; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }

._auth-confirm-box {
  text-align: center;
  padding: 20px 8px;
}
._auth-confirm-icon { font-size: 2rem; margin-bottom: 10px; }
._auth-confirm-box h3 { color: var(--accent); font-size: 1rem; margin-bottom: 8px; font-family: var(--font-body); }
._auth-confirm-box p  { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.6; font-family: var(--font-body); }

/* ============================================
   TOAST NOTIFICATIONS (showToast in api-client.js)
   ============================================ */
#_calc-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  animation: _toast-in 0.2s ease;
}

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

._calc-toast--error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border);  }
._calc-toast--warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
._calc-toast--success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }

._calc-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
}
._calc-toast-close:hover { opacity: 1; }

/* ============================================
   LOADING STATE (setCalcLoading in api-client.js)
   ============================================ */
.calc-loading {
  position: relative;
  pointer-events: none;
}

.calc-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.5);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calc-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: _spin 0.7s linear infinite;
}

@keyframes _spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   INPUT VALIDATION (setInputError in api-client.js)
   ============================================ */
._input-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15) !important;
}

._input-error {
  display: block;
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
}

/* ============================================
   SITE HEADER — shared across all pages
   ============================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 40px;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: transform 0.25s ease;
  will-change: transform;
}

.site-header--hidden {
  transform: translateY(-100%);
}

.site-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-deep);
  flex-shrink: 0;
}

.logo-icon svg { width: 18px; height: 18px; }

.logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 400;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.02em;
}

.site-nav a:hover { color: var(--text-primary); }

/* Language toggle (tool pages, login) */
.lang-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}
.lang-toggle button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.lang-toggle button:hover { color: var(--text-primary); }
.lang-toggle button.active {
  background: var(--accent-mid);
  color: #0d1117;
}

#auth-nav-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-session-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  flex-shrink: 0;
  animation: _pulse-dot 2.5s ease-in-out infinite;
}

@keyframes _pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.index-auth-email {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-auth-dashboard {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.index-auth-dashboard:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: transparent;
}

.index-auth-signout {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  transform: none;
  box-shadow: none;
}

.index-auth-signout:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: transparent;
  transform: none;
  box-shadow: none;
}

.index-auth-signin {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--bg-deep);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  transition: all 0.25s;
  box-shadow: var(--shadow-glow);
}

.index-auth-signin:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-lg);
}

/* Push page content below the fixed header */
body.has-site-header { padding-top: 73px; }

@media (max-width: 640px) {
  .site-header { padding: 14px 20px; }
  .site-nav a { display: none; }
}

/* ============================================
   SEMANTIC TYPE SYSTEM
   ============================================ */
h1, .h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}

h2, .h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-2xl);
  line-height: var(--lh-snug);
  color: var(--accent);
}

h3, .h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-xl);
  color: var(--text-primary);
}

h4, .h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text-secondary);
}

p, .body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

.h-display,
h1.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 1.08;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.h-display em,
.gradient-text {
  font-style: italic;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.eyebrow,
.section-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-mono-label);
  text-transform: uppercase;
  color: var(--accent);
}

.label,
label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.caption {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

code, .code, .mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.metric-value {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
}

.stat-number {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  min-height: 100vh;
  padding: 20px;
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
}

/* Presentation mode (learning platform) */
body.presentation-mode {
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  height: 100vh !important;
  height: -webkit-fill-available !important;
}

body.presentation-mode #app {
  height: 100vh;
  height: -webkit-fill-available;
}

body.presentation-mode .header {
  display: none;
}

body.presentation-mode #courseSelection {
  display: none !important;
}

/* ============================================
   HEADER (inner pages)
   ============================================ */
.header {
  background: linear-gradient(135deg, var(--header-from) 0%, var(--header-to) 100%);
  color: var(--text-primary);
  padding: 2rem;
  padding-left: 150px;
  text-align: center;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  border-bottom: 1px solid var(--accent-tint-12);
}

.back-btn {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: var(--font-body);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: translateY(-1px);
}

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

.header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.header p,
.header .subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* ============================================
   PSYCHROMETRIC CHART TOOLTIP
   ============================================ */
#psychro-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: rgba(15, 20, 30, 0.88);
  color: #f0f0f0;
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
#psychro-tooltip .tt-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 0 2rem 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.main-content {
  padding: 2rem;
}

.intro-section {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 2rem;
  background: var(--accent-tint-04);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-tint-10);
}

.intro-section h2 {
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
}

.intro-section p,
.intro {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
}

/* ============================================
   SECTIONS & CARDS
   ============================================ */
.calculator-section,
.controls-panel {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.calculator-section h2,
.calculator-section h3 {
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.calculator-section h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
}

/* Course Cards (Learning Platform) */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.course-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.course-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(-4px);
  border-color: var(--border-accent);
}

.course-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: var(--accent-tint-08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 1px solid var(--accent-tint-12);
}

.course-icon i {
  font-size: 1.75rem;
  color: var(--accent);
}

.course-card h3 {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.course-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
.input-group,
.form-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.input-field,
.input-item,
.form-group {
  display: flex;
  flex-direction: column;
}

.input-field label,
.input-item label {
  margin-bottom: 0.5rem;
}

.input-field input,
.input-field select,
.input-item input,
.input-item select,
input,
select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
}

.input-field input:focus,
.input-field select:focus,
.input-item input:focus,
.input-item select:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint-12);
}

input:disabled,
select:disabled {
  background-color: var(--surface);
  cursor: not-allowed;
  opacity: 0.5;
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Result Fields */
.result-field,
.info-box {
  background: var(--accent-tint-06);
  border: 1px solid rgba(201, 164, 92, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--accent);
  font-size: 1rem;
}

.info-box {
  border-left: 3px solid var(--accent);
  padding: 1.25rem;
  margin: 1rem 0;
  background: var(--accent-tint-04);
}

/* ============================================
   BUTTONS
   ============================================ */
button,
.btn,
.btn-primary,
.calculate-btn,
.home-btn {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent-mid));
  color: var(--bg-deep);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  font-family: var(--font-body);
}

button:hover,
.btn:hover,
.btn-primary:hover,
.calculate-btn:hover,
.home-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 164, 92, 0.25);
}

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

button:disabled,
.btn:disabled,
.btn-primary:disabled,
.calculate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.calculate-btn,
.btn-primary {
  width: 100%;
  margin: 1.25rem 0;
  padding: 1rem 1.5rem;
}

/* Tab Buttons */
.condition-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab-button {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-family: var(--font-body);
}

.tab-button:hover {
  background: var(--accent-tint-08);
  color: var(--accent);
  border-color: rgba(201, 164, 92, 0.2);
  box-shadow: none;
  transform: none;
}

.tab-button.active {
  background: var(--accent-tint-12);
  color: var(--accent);
  border-color: var(--border-accent);
}

/* ============================================
   TABLES
   ============================================ */
table,
.dli-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

thead th,
.dli-table thead th {
  background: linear-gradient(135deg, var(--header-from), var(--header-to));
  color: var(--text-secondary);
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(201, 164, 92, 0.15);
}

tbody td,
.dli-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

tbody tr:hover,
.dli-table tbody tr:hover {
  background-color: var(--accent-tint-04);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   RESULTS & OUTPUT
   ============================================ */
.results-section,
.result-grid {
  background: var(--surface);
  padding: 1.75rem;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.result-item {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.result-item h4,
.result-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-uppercase);
}

.result-item .value,
.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

/* ============================================
   PROGRESS & BADGES
   ============================================ */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
  transition: width 0.3s ease;
}

.course-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

.slides-count {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.completion-badge {
  color: var(--accent);
  font-size: 1.25rem;
}

.completion-badge.completed {
  color: var(--accent);
}

/* ============================================
   GRIDS & LAYOUTS
   ============================================ */
.main-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ============================================
   CHARTS & VISUALIZATIONS
   ============================================ */
.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  position: relative;
}

/* Psychrometric SVG chart */
#psychro-chart {
  width: 100%;
  max-width: 720px;
  display: block;
  background: #ffffff;
  border-radius: 4px;
}

/* Side-by-side layout: inputs left, chart right */
.psychro-layout {
  display: grid;
  grid-template-columns: 1fr 720px;
  gap: 1.5rem;
  align-items: start;
}

.psychro-layout .chart-container { margin: 0; }

/* 2×2 condition card grid in the left panel */
/* The reading. Statements about the air, one per line, with the caveats that
   qualify them kept visibly separate — a grower should be able to tell a
   measurement from a warning about the measurement. */
.psychro-reading:empty { display: none; }

.psychro-reading {
  margin: 1rem 0 0.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.psychro-reading-title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.psychro-reading-list,
.psychro-reading-caveats {
  margin: 0;
  padding: 0;
  list-style: none;
}

.psychro-reading-row {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.1rem;
  font-size: 0.87rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.psychro-reading-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
}
.psychro-reading-row--ok::before { background: #16a34a; }
.psychro-reading-row--watch::before { background: #d97706; }

.psychro-reading-caveats {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}
.psychro-reading-caveats li {
  padding: 0.2rem 0;
  font-size: 0.79rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.psychro-inputs-panel .conditions-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Compact card sizing */
.psychro-inputs-panel .condition-card {
  padding: 0.45rem 0.55rem;
}
.psychro-inputs-panel .condition-header {
  margin-bottom: 0.3rem;
}
.psychro-inputs-panel .condition-title h3 {
  font-size: 0.78rem;
}
.psychro-inputs-panel .condition-card label,
.psychro-inputs-panel .condition-card .input-item label {
  font-size: 0.62rem;
}
.psychro-inputs-panel .condition-card input {
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
}
.psychro-inputs-panel .condition-inputs .input-group {
  gap: 0.3rem;
  margin-bottom: 0.3rem;
}
.psychro-inputs-panel .legend {
  margin: 0.4rem 0 0;
  gap: 0.25rem 0.6rem;
  font-size: 0.72rem;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
  font-weight: 400;
}

.help-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Condition Panels */
.condition-panel {
  display: none;
}

.condition-panel.active {
  display: block;
}

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

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .toggle-slider {
  background: var(--accent-glow);
  border-color: var(--border-accent);
}

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

/* ============================================
   ENERGY.CSS COMPONENT OVERRIDES
   ============================================ */
.formula-box {
  background: var(--accent-tint-04);
  border: 1px solid rgba(201, 164, 92, 0.15);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.formula-box h4 {
  color: var(--accent);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.formula {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-secondary);
  background: var(--bg-deep);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  display: inline-block;
  border: 1px solid var(--border-hover);
}

.calculation-step {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin: 1rem 0;
}

.calculation-step h4 {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calculation-step h4 i {
  color: var(--accent);
}

.step-result {
  background: var(--accent-tint-06);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  color: var(--accent);
  display: inline-block;
  margin-top: 0.5rem;
}

.final-result {
  background: linear-gradient(135deg, var(--header-from), var(--header-to));
  border: 1px solid rgba(201, 164, 92, 0.2);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}

.final-result h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.final-result .value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
}

.final-result .unit {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.final-result .description {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.input-sections-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.input-section {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 0;
}

.input-section h3 {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.input-section h3 i {
  color: var(--accent);
}

.input-section h4 {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.results-section h3 {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.note-box {
  background: rgba(251, 191, 36, 0.06);
  border-left: 3px solid var(--warning);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin-top: 1.5rem;
}

.note-box strong {
  color: var(--warning);
}

/* Price Cells */
.price-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
  transition: transform 0.2s;
}

.price-cell:hover {
  transform: scale(1.05);
}

.price-cell.current {
  border: 1px solid var(--border-accent);
  background: var(--accent-tint-06);
}

.price-cell.low {
  background: var(--accent-tint-06);
  border-color: rgba(201, 164, 92, 0.25);
}

.price-cell.high {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
}

.price-cell .hour {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.price-cell .price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.price-cell.high .price {
  color: #ef4444;
}

.price-cell.low .price {
  color: var(--accent);
}

.loading-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* WKK Optimization */
.wkk-unit-card {
  margin-bottom: 1.5rem;
}

.wkk-unit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.wkk-unit-header h4 {
  color: var(--text-secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wkk-unit-header h4 i {
  color: var(--accent);
}

.remove-wkk-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
}

.remove-wkk-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: none;
  box-shadow: none;
}

/* Radio Groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-deep);
}

.radio-label:hover {
  border-color: rgba(201, 164, 92, 0.3);
  background: var(--accent-tint-04);
}

.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
}

.radio-label input[type="radio"]:checked + span {
  color: var(--accent);
  font-weight: 600;
}

.radio-label span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.radio-label span i {
  color: var(--accent);
}

/* Hourly input table */
#hourly-data-table input {
  border: 1px solid var(--border-hover);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  background: var(--bg-deep);
  color: var(--text-primary);
}

#hourly-data-table input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Results table hover */
#results-table tbody tr:hover {
  background: var(--accent-tint-04);
}

#results-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

/* Summary Cards */
.input-section[style*="text-align: center"] {
  transition: transform 0.2s, box-shadow 0.2s;
}

.input-section[style*="text-align: center"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================
   PSYCHRO SPECIFIC
   ============================================ */
.global-setting {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.conditions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.condition-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.condition-card:hover {
  border-color: var(--border-hover);
}

/* Used by psychro-ui.js when a condition toggle is turned off */
.condition-card.disabled .condition-inputs {
  opacity: 0.4;
  pointer-events: none;
}
.condition-card.disabled .condition-header {
  opacity: 0.6;
}

.condition-header {
  margin-bottom: 1rem;
}

.condition-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.condition-title h3 {
  font-size: 1rem;
  font-weight: 600;
}

.condition-inputs .input-group {
  margin-bottom: 0.75rem;
}

.condition-results .result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1rem;
  background: none;
  border: none;
  padding: 0.4rem 0 0;
  margin: 0;
}

.condition-results .result-item {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0;
}

.condition-results .result-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.condition-results .result-value {
  font-size: 0.82rem;
  /* Not a hardcoded white — .condition-card is a white card in this theme
     (modern-neutral.css), and this selector's specificity already beats
     that file's own .result-value { color: var(--accent) }, which is what
     every other result value on the site correctly uses. */
  color: var(--accent);
  font-weight: 500;
}

.psychro-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.btn--sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

/* Hidden by default */
.condition-results {
  display: none;
  margin-top: 0.25rem;
}
.conditions-grid.show-details .condition-results {
  display: block;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin: 1rem 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.learn-more {
  margin-top: 1.5rem;
  text-align: center;
}

.calculations {
  margin-top: 2rem;
  display: none;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.calc-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.calc-card h4 {
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.calc-card p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* RTR graph container */
.graph-container {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-height: 200px;
}

/* Disclaimer / footer */
.footer {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.footer h2 {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.disclaimer {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(251, 191, 36, 0.05);
  border-left: 3px solid var(--warning);
  border-radius: 0 6px 6px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.disclaimer strong {
  color: var(--warning);
}

/* Error messages */
.error-message {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

/* Light calculator DLI table */
.dli-table thead th {
  background: var(--header-from);
}

.lux-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.lux-result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
}

.lux-result-item h4 {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lux-result-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.conversion-factor {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

/* Tab content */
.tab-content {
  display: none;
  padding-top: 1.5rem;
}

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

.tab-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-wrap: wrap;
}

.tab-nav .tab-button {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  padding: 0.875rem 1.25rem;
}

.tab-nav .tab-button:last-child {
  border-right: none;
}

.tab-nav .tab-button.active {
  background: var(--surface);
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

/* Grouped "General calculations" dropdown in the tab bar. The menu opens on
   hover (and focus-within, for touch/keyboard). */
/* ── Shared result card (js/ui/result-card.js) ────────────────────────────────
   Five honest questions, one shape, everywhere: what the result is, what it
   is for, where its inputs came from, what it lets you change, whether it
   saved. Namespaced .hh-result-card / .hh-rc-* — .result-card is already
   energy.html's cost/revenue tile class. */
.hh-result-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.hh-rc-headline {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.hh-rc-headline-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}
.hh-rc-headline-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hh-rc-context {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.hh-rc-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}
.hh-rc-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.hh-rc-input-label { color: var(--text-secondary); }
.hh-rc-input-value { color: var(--text-primary); font-weight: 600; }
.hh-rc-input-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Assumed is the one that has to read as a warning — a measured or
   grower-entered value is ordinary, an invented one is not. */
.hh-rc-input--measured .hh-rc-input-badge { background: rgba(74, 222, 128, 0.14); color: #16a34a; }
.hh-rc-input--entered  .hh-rc-input-badge { background: rgba(148, 163, 184, 0.16); color: var(--text-secondary); }
.hh-rc-input--assumed  .hh-rc-input-badge { background: rgba(217, 119, 6, 0.16); color: #d97706; }

.hh-rc-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}
.hh-rc-controls-label { color: var(--text-secondary); margin-right: 0.15rem; }
.hh-rc-control-chip {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.hh-rc-saved {
  font-size: 0.78rem;
  font-weight: 600;
}
.hh-rc-saved--ok   { color: #16a34a; }
.hh-rc-saved--fail { color: #dc2626; }

.tab-dropdown {
  position: relative;
  display: inline-flex;
}

.tab-dropdown-trigger {
  cursor: pointer;
}

.tab-dropdown-trigger::after {
  content: ' \25BE'; /* ▾ */
}

.tab-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 100%;
  white-space: nowrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* An uncalibrated estimate, said where the number is. Muted rather than an
   alert box: the model is fine for comparing scenarios, it just must not be
   mistaken for a measurement. */
.rta-model-note {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2, transparent);
}
.rta-model-note[hidden] { display: none; }
.rta-model-note p {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.rta-sources summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.rta-sources dl {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}
.rta-sources dt {
  margin-top: 0.5rem;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--text-primary);
}
.rta-sources dd {
  margin: 0.15rem 0 0;
  color: var(--text-secondary);
}

.rta-model-version {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted, var(--text-secondary));
}

/* Tabs that are configuration rather than daily work, set apart from the ones
   beside them. A divider on the first of the group, not a separate element, so
   every child of the tablist stays a tab — a stray div in there is invalid and
   confuses a screen reader's count. */
.tab-nav .tab-button[data-tabgroup='admin']:first-of-type,
.tab-nav .tab-button:not([data-tabgroup='admin']) + .tab-button[data-tabgroup='admin'] {
  margin-left: 0.75rem;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
}

.tab-nav .tab-button[data-tabgroup='admin'] {
  opacity: 0.78;
}
.tab-nav .tab-button[data-tabgroup='admin']:hover,
.tab-nav .tab-button[data-tabgroup='admin'].active {
  opacity: 1;
}

/* :hover and :focus-within alone made these three tabs mouse-only. Focus cannot
   enter a display:none subtree, so it could never become :focus-within, so the
   menu never opened for a keyboard user — a circle only a class the trigger can
   toggle breaks. See _revealTab() in tab-system.js. */
.tab-dropdown:hover .tab-dropdown-menu,
.tab-dropdown:focus-within .tab-dropdown-menu,
.tab-dropdown--open .tab-dropdown-menu {
  display: block;
}

.tab-dropdown-menu .tab-button {
  display: block;
  width: 100%;
  text-align: left;
  border-right: none;
  border-bottom: 1px solid var(--border);
}

.tab-dropdown-menu .tab-button:last-child {
  border-bottom: none;
}

/* ============================================
   LEARNING PLATFORM STYLES
   ============================================ */
.course-selection {
  padding: 2rem 1rem;
}

.course-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
}

.course-card {
  position: relative;
  overflow: hidden;
}

/* Course Presentation */
.course-presentation {
  height: 100vh;
  height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  padding-bottom: env(safe-area-inset-bottom);
}

.presentation-header {
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
}

.course-title-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1.5rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header {
    padding: 1.5rem 1rem;
    padding-left: 1rem;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .main-content {
    padding: 1.25rem;
  }

  .input-group,
  .form-group {
    grid-template-columns: 1fr;
  }

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

  .condition-tabs {
    flex-direction: column;
  }

  .tab-button {
    border-radius: var(--radius-sm);
  }

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

  .input-sections-row {
    grid-template-columns: 1fr;
  }

  .wkk-unit-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .remove-wkk-btn {
    width: 100%;
    justify-content: center;
  }

  .lux-results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.25rem;
  }

  .header p {
    font-size: 0.82rem;
  }

  .calculator-section h2 {
    font-size: 1.1rem;
  }
}

/* ============================================
   PHASE 1 CLEANUP — NEW UTILITY CLASSES
   ============================================ */

/* Step headings (light.html DLI tab) */
.step-heading {
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
}

.step-heading:first-child {
  margin-top: 0;
}

/* Visualization action row */
.vis-section {
  margin-top: 1.5rem;
  text-align: center;
}

/* Embedded chart container (light.html) */
.chart-embed {
  margin-top: 1.5rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.chart-embed h3 {
  text-align: center;
  color: var(--accent);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  font-weight: 600;
}

/* Condition heading colors (psychro.html) */
.condition-title--outside { color: #FF6B6B; }
.condition-title--above   { color: #4ECDC4; }
.condition-title--inside  { color: #45B7D1; }
.condition-title--plant   { color: #96CEB4; }

/* Legend dot colors (psychro.html) */
.legend-dot--outside   { background: #FF6B6B; }
.legend-dot--above     { background: #4ECDC4; }
.legend-dot--inside    { background: #45B7D1; }
.legend-dot--plant     { background: #96CEB4; }
.legend-dot--rh        { background: #FECA57; }
.legend-dot--enthalpy  { background: #E65100; }
.legend-dot--sat-curve { background: #FF5722; }

/* Page subtitle (tab descriptions in energy.html) */
.page-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Margin-top utilities */
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

/* Flex utility */
.flex-1 { flex: 1; }

/* Final-result with no outer margin */
.final-result.no-margin { margin: 0; }

/* Compact final-result — for a headline card sitting beside a small input
   (e.g. weather.html's cold-hours progress next to its cultivar-target
   number field), where the full 3rem value reads oversized. */
.final-result.compact { padding: 1rem; }
.final-result.compact .value { font-size: 1.75rem; }

/* Compact note-box variant */
.note-box.note-box--compact {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
}

/* Summary statistics grid (energy.html) */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.stat-box {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0.1rem 0;
}

.stat-value--pos  { color: var(--accent); }
.stat-value--neg  { color: var(--danger); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Gas price history rows */
.price-history-section-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.price-history-row {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-history-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.price-history-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* Today stats summary (energy.html 3-col mini grid) */
.today-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.today-stat {
  text-align: center;
}

.today-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.today-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.today-stat-value--neg { color: var(--danger); }

/* Action row — centered button wrapper */
.action-row {
  text-align: center;
  margin-top: 1rem;
}

/* Scrollable table wrapper */
.table-scroll {
  overflow-x: auto;
  margin-top: 1rem;
}

/* Dark-themed data table (replaces light-themed inline styles) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
}

.data-table thead tr {
  background: linear-gradient(135deg, var(--header-from), var(--header-to));
  text-align: left;
}

.data-table thead th {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.data-table tbody td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: var(--accent-tint-04);
}

/* Horizontal radio group variant */
.radio-group.radio-group--row {
  flex-direction: row;
  gap: 0.5rem;
}

.radio-group--row .radio-label {
  flex: 1;
  padding: 0.5rem;
}

/* WKK calculated outputs display */
.wkk-outputs {
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Optimization status text */
.opt-status {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* WKK result summary cards */
.result-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.result-card h4 {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.result-card .value--xl {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-card .value--lg {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-card .sub-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.result-card--profit  { border-top: 2px solid var(--accent);  }
.result-card--revenue { border-top: 2px solid var(--blue); }
.result-card--co2     { border-top: 2px solid var(--warning); }
.result-card--cost    { border-top: 2px solid var(--danger); }

.result-card--profit  .value--xl,
.result-card--profit  .value--lg { color: var(--accent); }

.result-card--revenue .value--xl,
.result-card--revenue .value--lg { color: var(--blue); }

.result-card--co2     .value--xl,
.result-card--co2     .value--lg { color: var(--warning); }

.result-card--cost    .value--xl,
.result-card--cost    .value--lg { color: var(--danger); }

/* Secondary button (for non-primary actions like export, save, toggle) */
.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-hover);
  width: auto;
  margin: 0;
  padding: 0.65rem 1.25rem;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: none;
}

/* Icon size standardisation (FontAwesome) */
h2 i.fas, h2 i.far,
h3 i.fas, h3 i.far,
h4 i.fas, h4 i.far {
  font-size: 0.85em;
  vertical-align: middle;
}

.help-text i.fas,
.help-text i.far {
  font-size: 0.85em;
  vertical-align: middle;
  color: var(--accent);
  opacity: 0.7;
}

.note-box i.fas,
.note-box i.far {
  font-size: 1em;
  vertical-align: middle;
}

/* Spacing between stacked input-fields within the same input-section */
.input-section .input-field + .input-field {
  margin-top: 1rem;
}

/* ── Compact form spacing (all tool panels) ── */

/* energy.html — .input-section */
.input-section .form-group {
  margin-bottom: 0.5rem;
  gap: 0.2rem;
}
.input-section .form-group label,
.input-section .input-field label {
  font-size: 0.78rem;
  margin-bottom: 0.1rem;
}
.input-section .form-group input,
.input-section .form-group select,
.input-section .input-field input,
.input-section .input-field select {
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}
.input-section .help-text {
  font-size: 0.7rem;
  margin-top: 0.1rem;
}
.input-section .input-field + .input-field {
  margin-top: 0.5rem;
}

/* psychro.html — .condition-card and .calc-card */
.condition-card .form-group,
.condition-card .input-group,
.calc-card .form-group {
  margin-bottom: 0.4rem;
  gap: 0.4rem;
}
.condition-card .input-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.condition-card label,
.condition-card .input-item label,
.calc-card label {
  font-size: 0.75rem;
  margin-bottom: 0;
}
.condition-card input,
.condition-card select,
.calc-card input,
.calc-card select {
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}
.condition-card .help-text,
.calc-card .help-text {
  font-size: 0.7rem;
  margin-top: 0.1rem;
}
.condition-inputs .input-group {
  margin-bottom: 0.4rem;
}

/* light.html — .input-group / .input-field */
.tab-content .input-group {
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tab-content .input-field label {
  font-size: 0.78rem;
  margin-bottom: 0.1rem;
}
.tab-content .input-field input,
.tab-content .input-field select {
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}
.tab-content .help-text {
  font-size: 0.7rem;
  margin-top: 0.1rem;
}

/* Margin-bottom utilities */
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }

/* stat-box with extra bottom spacing */
.stat-box.stat-box--spaced {
  margin-bottom: 1rem;
}

/* Flex action row (for side-by-side buttons) */
.action-row.action-row--flex {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-row.action-row--flex .btn-secondary,
.action-row.action-row--flex .btn-primary {
  width: auto;
  margin: 0;
}

/* ============================================
   PHASE 2 — LAYOUT & HIERARCHY
   ============================================ */

/* --- How-to hint bar --- */
.how-to-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--accent-tint-04);
  border: 1px solid var(--accent-tint-12);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.how-to-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}

.how-to-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-tint-12);
  border: 1px solid rgba(201, 164, 92, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.how-to-arrow {
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0 0.1rem;
}

/* --- Calculation steps timeline (energy heat emission) --- */
.calc-steps-timeline {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid rgba(201, 164, 92, 0.18);
  margin-left: 0.5rem;
}

.calc-steps-timeline .calculation-step {
  position: relative;
}

.calc-steps-timeline .calculation-step::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 1.1rem;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 8px rgba(201, 164, 92, 0.4);
}

.calc-steps-timeline .calculation-step + .calculation-step {
  margin-top: 0.75rem;
}

/* --- Tab active state — more distinct --- */
.tab-nav .tab-button.active {
  background: var(--accent-tint-12) !important;
  color: var(--accent) !important;
  border-bottom: 3px solid var(--accent) !important;
  font-weight: 600;
}

/* --- LUX result cards — bigger values --- */
.lux-result-item {
  border-top: 2px solid rgba(201, 164, 92, 0.2);
  transition: transform 0.2s, border-top-color 0.2s;
}

.lux-result-item:hover {
  transform: translateY(-2px);
  border-top-color: var(--accent);
}

.lux-result-value {
  font-size: 2.4rem !important;
  font-weight: 700;
  line-height: 1.1;
  margin: 0.4rem 0;
}

/* --- DLI table optimal range rows --- */
/* Rows that reach the target DLI. Green rather than the brand accent: this is
   a verdict on a number, and the page already speaks that green for RNP's
   "target" classification (.rnp-classification[data-class="target"]). */
.dli-table tr.dli-target-met td {
  background: var(--success-bg);
  color: var(--success);
  font-weight: 600;
}

.dli-table tr.dli-target-met td:first-child {
  border-left: 2px solid var(--success);
}

/* --- Psychro condition card left borders --- */
#outside-card { border-left: 3px solid #FF6B6B; }
#above-card   { border-left: 3px solid #4ECDC4; }
#inside-card  { border-left: 3px solid #45B7D1; }
#plant-card   { border-left: 3px solid #96CEB4; }

/* --- Learn-more / calculations section (psychro.html) --- */
.learn-more-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.learn-more-divider::before,
.learn-more-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,164,92,0.2), transparent);
}

.calculations {
  background: var(--bg-deep) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 2rem !important;
  margin-top: 1rem !important;
}

/* --- RTR step indicator --- */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.step-ind-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.3s;
}

.step-ind-item.active {
  color: var(--accent);
}

.step-ind-item.completed {
  color: var(--accent-mid);
}

.step-ind-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 1px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.3s;
}

.step-ind-item.active .step-ind-num {
  background: var(--accent);
  color: var(--bg-deep);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(201,164,92,0.3);
}

.step-ind-item.completed .step-ind-num {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--border-accent);
}

.step-ind-sep {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 16px;
}

/* --- Section reveal animation (RTR night/graph sections) --- */
@keyframes section-slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-reveal {
  animation: section-slide-in 0.4s ease forwards;
}

/* --- WKK optimization status states --- */
.opt-status--loading { color: var(--warning); }
.opt-status--success { color: var(--accent); }
.opt-status--error   { color: var(--danger); }

/* --- Learning platform improvements --- */
.back-to-overview-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem !important;
  background: var(--surface) !important;
  border: 1px solid var(--border-hover) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-secondary) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body) !important;
}

.back-to-overview-btn:hover {
  background: var(--bg-card-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--accent) !important;
  transform: none !important;
  box-shadow: none !important;
}

.course-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.45rem 0.9rem;
  background: rgba(201, 164, 92, 0.07);
  border: 1px solid rgba(201, 164, 92, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  font-family: var(--font-body);
}

.course-cta:hover {
  background: rgba(201, 164, 92, 0.14);
  border-color: rgba(201, 164, 92, 0.4);
}

/* Slide type badge (Content / Quiz) */
.slide-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-tint-10);
  border: 1px solid rgba(201, 164, 92, 0.2);
  color: var(--accent);
  margin-left: 0.75rem;
  vertical-align: middle;
}

.slide-type-badge.badge--quiz {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

/* Data table cell variants */
.td-hour { text-align: center; font-weight: 600; color: var(--text-secondary); }
.td-num  { text-align: right; }
.td-bold { font-weight: 700; }
.td-profit-pos { color: var(--accent); }
.td-profit-neg { color: var(--danger); }

/* Toggle row layout (replaces inline flex) */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Loading placeholder improvements */
.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.loading-placeholder::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: _spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   RTR CALCULATOR — 3-COLUMN PANEL LAYOUT
   ═══════════════════════════════════════════════════════ */

.rtr-panel-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1.5fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .rtr-panel-grid {
    grid-template-columns: 1fr;
  }
}

.rtr-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Compact form fields inside RTR panels */
.rtr-panel .form-group {
  margin-bottom: 0.5rem;
  gap: 0.2rem;
}

.rtr-panel .form-group label {
  font-size: 0.78rem;
  margin-bottom: 0.1rem;
}

.rtr-panel .form-group input,
.rtr-panel .form-group select {
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
}

.rtr-panel .help-text {
  font-size: 0.7rem;
  margin-top: 0.1rem;
}

.rtr-panel .btn-primary {
  margin-top: 0.5rem;
  padding: 0.55rem 1rem;
}

.rtr-panel-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.rtr-panel--results {
  background: var(--bg-deep);
  border-color: var(--border-hover);
}

/* Section divider inside middle panel */
.rtr-section-divider {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1rem 0 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Results panel internals ── */

.rtr-result-primary {
  text-align: center;
  padding: 1rem 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
  margin-bottom: 0.75rem;
  transition: background 0.3s ease;
}

.rtr-result-primary--active {
  background: rgba(201, 164, 92, 0.07);
}

.rtr-result-primary--night.rtr-result-primary--active {
  background: rgba(96, 165, 250, 0.07);
}

.rtr-result-primary-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.rtr-result-primary-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.3s ease;
}

.rtr-result-primary--active .rtr-result-primary-value {
  color: var(--accent);
}

.rtr-result-primary-value--night {
  color: var(--text-muted);
}

.rtr-result-primary--night.rtr-result-primary--active .rtr-result-primary-value--night {
  color: var(--blue);
}

/* Horizontal divider between RTR and night results */
.rtr-results-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

/* Detail rows */
.rtr-result-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rtr-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.2rem 0;
}

.rtr-result-name {
  color: var(--text-muted);
}

.rtr-result-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   RTA CALCULATOR
   ============================================ */

.rta-crop-selector {
  background: var(--surface);
  border: 2px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.rta-crop-selector-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.rta-crop-required {
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}

.rta-crop-selector-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.rta-crop-select {
  min-width: 180px;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
}

.rta-crop-presets {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.rta-crop-presets strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Step cards */
.rta-steps-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .rta-steps-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .rta-steps-row {
    grid-template-columns: 1fr;
  }
}

.rta-step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.rta-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent-dark);
  color: var(--bg-deep);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.rta-step-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.rta-step-formula {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-mid);
  margin-bottom: 0.5rem;
}

.rta-step-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.rta-step-result {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

/* Factor table */
.rta-factors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.rta-factors-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.rta-factors-table td {
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Final value display */
.rta-final-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.rta-final-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.rta-final-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── RNP Calculator ─────────────────────────────────────────── */
.rnp-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.rnp-section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.rnp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 600px) {
  .rnp-two-col { grid-template-columns: 1fr; }
}

.rnp-col-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.rnp-classification {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-secondary);
}
/* The darker shade of each hue: the brighter ones read at 3–4.4:1 on their
   tints, under AA for text this size (css_contrast_test). */
.rnp-classification[data-class="very-low"] { background: #fef2f2; color: #b91c1c; }
.rnp-classification[data-class="low"]      { background: #fff7ed; color: #b45309; }
.rnp-classification[data-class="target"]   { background: #f0fdf4; color: #166534; }
.rnp-classification[data-class="high"]     { background: #eff6ff; color: #2563eb; }

.rnp-interp {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 1rem;
  line-height: 1.5;
  min-height: 1.2em;
}

/* Saving the day's RNP is deliberate, so it looks like an action rather than a
   result. Disabled until the inputs make a day: see _rnpSetSaveState(). */
.rnp-save-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.rnp-save-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #4a7c59;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.rnp-save-btn:hover:not(:disabled) { background: #2c5530; }
.rnp-save-btn:disabled {
  background: var(--surface-2, #f1f5f9);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.rnp-save-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: #16a34a;
}

.rnp-incomplete {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}

.rnp-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.rnp-ref-table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
}
.rnp-ref-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.rnp-ref-val { font-weight: 700; }
.rnp-ref-target { color: #16a34a; }
.rnp-ref-low    { color: #d97706; }

/* RNP — additional classification colours (v3 worksheet) */
.rnp-classification[data-class="critical"]    { background: #fee2e2; color: #991b1b; }
.rnp-classification[data-class="moderate"]    { background: #fefce8; color: #a16207; }
.rnp-classification[data-class="natural-sun"] { background: #eff6ff; color: #2563eb; }

.rnp-ref-critical { color: #991b1b; }

.rnp-field-full { flex: 1 1 100%; }
.rnp-custom-row { margin-top: -8px; }

/* RNP — LED spectrum builder (appears under Custom factor) */
.rnp-spectrum-helper {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.02);
}

.rnp-helper-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.rnp-helper-foot {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  margin: 6px 0 0;
}

.rnp-spectrum-status {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 8px 0 0;
  min-height: 1.2em;
}
.rnp-spectrum-status[data-valid="1"] { color: #16a34a; }
.rnp-spectrum-status[data-valid="0"] { color: #d97706; }

/* RNP — solar helper (same box style as spectrum helper) */
.rnp-solar-helper {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.04);
}

/* RNP — per-column hint text under the LED PAR row */
.rnp-col-help {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  margin: 6px 0 12px;
  font-style: italic;
  line-height: 1.45;
}

/* ============================================
   CONTEXTUAL HELP SYSTEM (help-modal.js)
   ============================================ */

/* "?" button — injected into .site-nav or .dash-topbar-right */
.hh-help-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border, #e2e8f0);
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-left: 0.5rem;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}
.hh-help-btn:hover {
  border-color: var(--accent, #4a9c75);
  color: var(--accent, #4a9c75);
  background: rgba(74, 156, 117, 0.06);
}

/* ── The "?" that explains one heading (js/ui/info-toggle.js) ──────────────
   Smaller than the nav's .hh-help-btn because it sits inside a heading beside
   its words rather than in a bar of its own. Two jobs, one button:

     aria-controls  → shows and hides the paragraph already under the heading
     data-help-open → opens the help modal, for text about the whole tab

   The revealed paragraph keeps whatever class it already had (.help-text and
   friends), so nothing here styles the content — only the button. That is
   deliberate: the explanation is the same prose it always was, merely quiet
   until asked, and a page's theme keeps owning how it looks. */
.hh-info__btn {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  margin-left: 0.4rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted, #64748b);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.hh-info__btn:hover,
.hh-info__btn:focus-visible,
.hh-info__btn[aria-expanded='true'] {
  border-color: var(--accent, #4a9c75);
  color: var(--accent, #4a9c75);
}

/* The floating form, for a note beside an inline chip rather than under a
   heading. The popover anchors to .hh-h--info (the heading), not to the
   button, so it never runs off the right edge when the heading wraps on a
   phone. Kept narrow on purpose — anything longer than a couple of lines
   belongs in the reveal-in-place form above, which cannot overflow. */
.hh-h--info {
  position: relative;
}
.hh-info {
  display: inline-block;
  vertical-align: middle;
}
.hh-info__pop {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: var(--bg-card, #ffffff);
  color: var(--text-primary, #0f172a);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.hh-info.is-open .hh-info__pop {
  display: block;
}

/* A name for a control whose visible text is a glyph. The accessible name is
   computed from content before title, so `<button title="Explain">?</button>`
   still announces as "question mark, button" — the hidden span is the name and
   aria-hidden on the glyph keeps the punctuation out of it. Same idiom as
   .nut-rail__title in css/nutrient.css, lifted here so every page has it. */
.hh-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media print {
  /* The explanations used to be on the page, so they used to print. A reader
     who asked for paper did not ask for less than they had. */
  [id^='info-'][hidden] {
    display: block !important;
  }
  .hh-info__btn {
    display: none;
  }
}

/* Help modal backdrop — reuses .dash-modal-backdrop from dashboard.css  */
/* but keyed to #hh-help-backdrop to avoid conflicts with settings modal */
#hh-help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4.5rem 1.5rem 1.5rem;
}
#hh-help-backdrop[hidden] { display: none; }

/* Help modal box */
#hh-help-modal {
  background: var(--card-bg, #1a2332);
  border: 1px solid var(--border, #2a3547);
  border-radius: 10px;
  width: 100%;
  max-width: 360px;
  max-height: calc(100vh - 6rem);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

/* Header */
.hh-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border, #2a3547);
  flex-shrink: 0;
}
.hh-help-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text, #e2e8f0);
  margin: 0;
}
.hh-help-tab-badge {
  font-size: 0.7rem;
  background: rgba(74, 156, 117, 0.15);
  color: var(--accent, #4a9c75);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.5rem;
  font-weight: 600;
}
.hh-help-close {
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s;
}
.hh-help-close:hover { color: var(--text, #e2e8f0); }

/* Scrollable body */
.hh-help-body {
  padding: 1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
}

/* Intro sentence */
.hh-help-intro {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 0.9rem;
  line-height: 1.5;
}

/* Numbered steps */
.hh-help-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 0.9rem;
}
.hh-help-steps li {
  font-size: 0.85rem;
  color: var(--text, #e2e8f0);
  padding: 0.3rem 0;
  display: flex;
  gap: 0.6rem;
  line-height: 1.45;
}
.hh-help-step-num {
  font-weight: 700;
  color: var(--accent, #4a9c75);
  min-width: 1.1rem;
  flex-shrink: 0;
}

/* Tips section */
.hh-help-tips {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  border-top: 1px solid var(--border, #2a3547);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  line-height: 1.5;
}
.hh-help-tips strong {
  color: var(--text, #e2e8f0);
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* A course whose text is not in the reader's language yet. Small, quiet and
   next to the title — the content is still worth reading, it just has not been
   translated. See HH.pickLangInfo in js/utils/hh-utils.js. */
.course-lang-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.05rem 0.32rem;
  border-radius: 3px;
  font-size: 0.6em;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  border: 1px solid currentColor;
  opacity: 0.55;
}
