/* ============================================================
   ASTRO Corrosion Module — Pungo Tech Design System
   Premium Industrial UI for Oil & Gas Engineers
   ============================================================ */

/* ----- CSS Reset ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ----- Custom Properties (Brand Tokens) ----- */
:root {
  /* Brand colors */
  --primary: #8EC14B;
  --primary-dark: #6ea032;
  --secondary: #007297;
  --secondary-dark: #005a78;
  --gradient: linear-gradient(135deg, #8EC14B 0%, #358C7C 50%, #007297 100%);
  --gradient-horizontal: linear-gradient(90deg, #8EC14B 0%, #358C7C 50%, #007297 100%);

  /* Semantic */
  --success: #52b26b;
  --warning: #e8a020;
  --error: #d94f3d;
  --error-dark: #7f1d1d;
  --info: #1B7B8B;

  /* Neutrals */
  --gray-50: #F8FAFB;
  --gray-100: #F0F4F5;
  --gray-200: #E1E8EA;
  --gray-300: #C8D4D8;
  --gray-400: #9AB0B8;
  --gray-500: #6D8A93;
  --gray-600: #4A6570;
  --gray-700: #2E4550;
  --gray-800: #1A2D35;
  --gray-900: #0D1A1F;

  /* Surfaces */
  --page-bg: #F8FAFB;
  --surface: #FFFFFF;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 114, 151, 0.10);
  --shadow-md: 0 4px 16px rgba(0, 114, 151, 0.14);
  --shadow-lg: 0 8px 32px rgba(0, 114, 151, 0.18);
  --shadow-hover: 0 6px 24px rgba(0, 114, 151, 0.18);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font-heading: 'Roboto', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  /* Transitions */
  --transition: all 0.2s ease;

  /* Layout */
  --sidebar-width: 280px;
  --topbar-height: 56px;
}

/* ----- Global ----- */
html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--page-bg);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.25;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 0.5rem; }

a {
  color: var(--secondary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--secondary-dark); }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }

/* ----- Utilities ----- */
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }

/* ----- Fade Animation ----- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.fade-in { animation: fadeInUp 0.4s ease both; }
.fade-in-delay-1 { animation: fadeInUp 0.4s ease 0.1s both; }
.fade-in-delay-2 { animation: fadeInUp 0.4s ease 0.2s both; }
.fade-in-delay-3 { animation: fadeInUp 0.4s ease 0.3s both; }

/* ==========================================================
   LANDING PAGE
   ========================================================== */

/* --- Landing Header --- */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 3rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.landing-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.landing-logo img {
  height: 36px;
  object-fit: contain;
}
.landing-logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--gray-900);
  letter-spacing: 0.5px;
}
.landing-logo-text span {
  color: var(--secondary);
}
.landing-header-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.landing-header-links a {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
}
.landing-header-links a:hover {
  color: var(--secondary);
}

/* --- Hero --- */
.landing-hero {
  background: var(--gradient);
  padding: 5rem 3rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(255,255,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}
.landing-hero-inner {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.landing-hero h1 {
  color: #fff;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}
.landing-hero p {
  color: rgba(255,255,255,0.9);
  font-size: 1.15rem;
  line-height: 1.7;
  max-width: 680px;
  margin: 0 auto 2rem;
}
.landing-hero .badge-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
}

/* --- CTA --- */
.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  color: var(--secondary);
  padding: 0.85rem 2.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.landing-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
  filter: brightness(0.96);
}
.landing-cta i {
  width: 18px;
  height: 18px;
}

/* --- Features --- */
.landing-features {
  max-width: 1100px;
  margin: -2.5rem auto 3rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  position: relative;
  z-index: 2;
}
.feature-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  text-align: center;
}
.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, rgba(142,193,75,0.12), rgba(0,114,151,0.12));
}
.feature-icon i {
  width: 26px;
  height: 26px;
  color: var(--secondary);
}
.feature-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
  color: var(--gray-900);
}
.feature-card p {
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* --- Architecture Section --- */
.landing-architecture {
  max-width: 960px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}
.architecture-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-sm);
}
.architecture-card h2 {
  text-align: center;
  margin-bottom: 0.5rem;
}
.architecture-card > p {
  text-align: center;
  color: var(--gray-500);
  margin-bottom: 2rem;
}
.architecture-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 2rem 0;
}
.arch-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  min-width: 130px;
}
.arch-step-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.arch-step-icon i { width: 24px; height: 24px; color: #fff; }
.arch-step-icon.green { background: var(--primary); }
.arch-step-icon.teal  { background: #358C7C; }
.arch-step-icon.blue  { background: var(--secondary); }
.arch-step-icon.dark  { background: var(--gray-800); }
.arch-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  text-align: center;
}
.arch-arrow {
  color: var(--gray-300);
  display: flex;
  align-items: center;
}
.arch-arrow i { width: 22px; height: 22px; }

/* --- Metrics Row --- */
.landing-metrics {
  max-width: 960px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.metric-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.metric-card .metric-val {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
}
.metric-card .metric-label {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* --- Footer --- */
.landing-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: 0.82rem;
  border-top: 1px solid var(--gray-200);
}

/* ==========================================================
   DASHBOARD LAYOUT
   ========================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow: hidden;
}
.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.sidebar-header img {
  height: 28px;
  object-fit: contain;
}
.sidebar-header-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-900);
}
.sidebar-header-text span {
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 500;
  display: block;
  margin-top: -2px;
}
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
}
.sidebar-divider {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-400);
  margin: 1.25rem 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.sidebar-actions {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Topbar --- */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-title i { width: 20px; height: 20px; color: var(--secondary); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

/* ==========================================================
   COMPONENTS
   ========================================================== */

/* --- Cards --- */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-hover);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title i { width: 18px; height: 18px; color: var(--secondary); }

/* --- Tabs --- */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 0.7rem 1.25rem;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn i { width: 16px; height: 16px; }
.tab-btn:hover {
  color: var(--secondary);
}
.tab-btn.active {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
}
.tab-panel {
  display: none;
  animation: fadeInUp 0.3s ease;
}
.tab-panel.active {
  display: block;
}

/* Tab bar: results group | tools group */
.tab-divider { width: 1px; align-self: stretch; margin: 0.6rem 0.5rem; background: var(--gray-300); flex-shrink: 0; }
.tab-btn.tab-tool:not(.active) { color: var(--gray-400); }
.tab-btn.tab-tool:not(.active):hover { color: var(--secondary); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn i { width: 16px; height: 16px; }
.btn:hover { filter: brightness(0.9); }
.btn:active { transform: scale(0.98); }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

.btn-primary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.btn-secondary {
  background: transparent;
  color: var(--secondary);
  border-color: var(--gray-300);
}
.btn-secondary:hover {
  border-color: var(--secondary);
  background: rgba(0,114,151,0.04);
}
.btn-link {
  background: transparent;
  color: var(--secondary);
  border-color: transparent;
  padding: 0.4rem 0.6rem;
  font-weight: 500;
}
.btn-link:hover { filter: none; text-decoration: underline; }
.btn-accent {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}

.btn-full { width: 100%; }
.btn-lg {
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 0.85rem;
}
.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 0.3rem;
}
.form-label-value {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--secondary);
  font-size: 0.82rem;
}
.form-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  color: var(--gray-800);
  transition: var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,114,151,0.1);
}
.form-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-input-row .form-input { flex: 1; }
.form-unit {
  font-size: 0.72rem;
  color: var(--gray-400);
  white-space: nowrap;
  min-width: 32px;
}

/* --- Range Slider --- */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--gray-200);
  outline: none;
  transition: var(--transition);
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--secondary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,114,151,0.3);
  transition: var(--transition);
}
.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(0,114,151,0.4);
}
.form-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--secondary);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0,114,151,0.3);
}

/* --- Radio Group --- */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-700);
  border: 1.5px solid transparent;
}
.radio-option:hover {
  background: var(--gray-50);
}
.radio-option.selected {
  background: rgba(0,114,151,0.06);
  border-color: var(--secondary);
  color: var(--secondary);
}
.radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.radio-option.selected .radio-dot {
  border-color: var(--secondary);
}
.radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: var(--transition);
}
.radio-option.selected .radio-dot::after {
  background: var(--secondary);
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:nth-child(even) td {
  background: var(--gray-50);
}
.data-table tr:hover td {
  background: rgba(0,114,151,0.03);
}
.data-table .batch-sub {
  font-size: 0.72rem;
  color: var(--gray-500);
  margin-top: 2px;
  white-space: nowrap;
}
.data-table .cell-mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* --- Charts --- */
.chart-container {
  position: relative;
  width: 100%;
  max-height: 360px;
}
.chart-container canvas {
  width: 100% !important;
  max-height: 360px;
}

/* --- Upload Zone --- */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--secondary);
  background: rgba(0,114,151,0.03);
}
.upload-zone i {
  width: 40px;
  height: 40px;
  color: var(--gray-400);
  margin-bottom: 0.75rem;
}
.upload-zone p {
  color: var(--gray-500);
  font-size: 0.9rem;
}
.upload-zone .upload-hint {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
}

/* --- Loading Overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248,250,251,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 1rem;
}
.loading-text {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--gray-600);
  font-weight: 500;
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.empty-state-icon i {
  width: 32px;
  height: 32px;
  color: var(--gray-400);
}
.empty-state h3 {
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}
.empty-state p {
  color: var(--gray-400);
  font-size: 0.9rem;
  max-width: 360px;
}

/* --- Framework Content --- */
.framework-content {
  max-width: 780px;
}
.framework-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.framework-content h2:first-child { margin-top: 0; }
.framework-content h2 i { width: 22px; height: 22px; color: var(--secondary); }
.framework-content h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--gray-800);
}
.framework-content p {
  color: var(--gray-600);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.framework-content ul {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}
.framework-content li {
  padding: 0.35rem 0 0.35rem 1.25rem;
  position: relative;
  color: var(--gray-600);
  line-height: 1.6;
}
.framework-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
}
.framework-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--secondary);
}
.metric-highlight {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  margin: 0.1rem 0;
}
.metric-highlight strong {
  font-family: var(--font-mono);
  color: var(--secondary);
}

/* --- Optimization Card --- */
.optimization-card {
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.optimization-card.opt-savings {
  background: rgba(82,178,107,0.06);
  border: 1px solid rgba(82,178,107,0.2);
}
.optimization-card.opt-deficit {
  background: rgba(217,79,61,0.06);
  border: 1px solid rgba(217,79,61,0.2);
}
.optimization-card.opt-warning {
  background: rgba(232,160,32,0.06);
  border: 1px solid rgba(232,160,32,0.2);
}
.optimization-card h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.optimization-card h4 i { width: 20px; height: 20px; }
.opt-savings h4 i { color: var(--success); }
.opt-deficit h4 i { color: var(--error); }
.opt-warning h4 i { color: var(--warning); }
.optimization-card p {
  font-size: 0.9rem;
  color: var(--gray-600);
  line-height: 1.6;
}
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.opt-row:last-child { border-bottom: none; }
.opt-row-label { font-size: 0.85rem; color: var(--gray-600); }
.opt-row-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
}

/* --- Diagnostics --- */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.diag-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  text-align: center;
}
.diag-card .diag-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
}
.diag-card .diag-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.diag-card .diag-interp {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
  line-height: 1.5;
}

/* --- Batch Results --- */
.batch-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.batch-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* --- Column List --- */
.column-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem 1rem;
  margin: 0.75rem 0;
}
.column-list code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--gray-100);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  color: var(--gray-700);
}

/* ==========================================================
   APP.JS COMPONENT STYLES
   ========================================================== */

/* --- Landing Header Inner --- */
.landing-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem;
}
.landing-logo { height: 32px; }
.landing-product-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: 0.5px;
}
.landing-header-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.landing-user-email {
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
}
.login-back {
  margin: 0.75rem auto 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* --- Landing Hero Content --- */
.landing-hero-content {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.landing-hero-sub {
  color: rgba(255,255,255,0.88);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 680px;
  margin: 0 auto 2rem;
}

/* --- Hero Button --- */
.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  color: var(--secondary);
  padding: 0.85rem 2.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
}
.btn-hero i { width: 18px; height: 18px; }

/* --- Landing Architecture --- */
.landing-architecture {
  max-width: 960px;
  margin: 3rem auto 3rem;
  padding: 0 2rem;
  text-align: center;
}
.landing-architecture h2 {
  margin-bottom: 2rem;
  color: var(--gray-800);
}
.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}
.arch-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 1.25rem;
  min-width: 120px;
}
.arch-step span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}
.arch-step small {
  font-size: 0.72rem;
  color: var(--gray-400);
}
.arch-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(142,193,75,0.15), rgba(0,114,151,0.15));
}
.arch-icon i { width: 24px; height: 24px; color: var(--secondary); }
.arch-step-result .arch-icon {
  background: var(--secondary);
}
.arch-step-result .arch-icon i { color: #fff; }
.arch-arrow {
  color: var(--gray-300);
  display: flex;
  align-items: center;
}
.arch-arrow i { width: 20px; height: 20px; }

/* --- Landing Footer --- */
.landing-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray-400);
  font-size: 0.82rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

/* --- Sidebar Scroll / Sections --- */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-section {
  padding: 0.75rem 1.25rem;
}
.sidebar-section-title {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-400);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sidebar-section-title i { width: 14px; height: 14px; }

.sidebar-logo { height: 28px; }

/* --- Model Radios --- */
.model-radios {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.radio-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}
.radio-card:hover { background: var(--gray-50); }
.radio-card-active {
  background: rgba(0,114,151,0.06);
  border-color: var(--secondary);
}
.radio-card input[type="radio"] { margin: 0; accent-color: var(--secondary); }
.radio-card-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  display: block;
}
.radio-card-desc {
  font-size: 0.7rem;
  color: var(--gray-400);
  display: block;
}

/* --- Slider Row --- */
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.slider-row .form-range { flex: 1; }
.slider-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--secondary);
  min-width: 48px;
  text-align: right;
}

/* --- Form Group Inline --- */
.form-group-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.form-group-inline .form-label {
  flex: 1;
  margin-bottom: 0;
  font-size: 0.72rem;
}
.form-input-sm {
  width: 80px !important;
  min-width: 80px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  text-align: right;
}

/* --- Button Variants --- */
.btn-block { width: 100%; }
.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

/* --- Main Area (dashboard right panel) --- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Topbar Enhancements --- */
.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.topbar-left h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}
.topbar-subtitle {
  font-size: 0.78rem;
  color: var(--gray-400);
  font-weight: 500;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
  overflow-y: auto;
}

/* --- Section Title --- */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 1.5rem 0 0.75rem;
}
.section-title i { width: 16px; height: 16px; color: var(--secondary); }

/* --- Chart Card --- */
.chart-card { position: relative; }

/* --- Toggle Group (Confidence Basis) --- */
.toggle-group {
  display: inline-flex;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--gray-50);
}
.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.toggle-btn i { width: 14px; height: 14px; }
.toggle-btn:hover {
  color: var(--secondary);
  background: rgba(0, 114, 151, 0.04);
}
.toggle-btn-active {
  background: var(--secondary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.toggle-btn-active:hover {
  background: var(--secondary-dark);
  color: #fff;
}

/* --- Form Hint --- */
.form-hint {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.4rem;
  line-height: 1.5;
}

/* --- Recommendation Cards --- */
.recommendation-cost {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 114, 151, 0.06);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--secondary);
}
.recommendation-cost i { width: 14px; height: 14px; flex-shrink: 0; }

/* --- Diagnostic Metric Tracks --- */
.metric-container {
  margin: 1rem 0;
}
.metric-track {
  height: 8px;
  border-radius: 4px;
  position: relative;
  width: 100%;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.metric-pin {
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 3px solid var(--secondary);
  border-radius: 50%;
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  box-shadow: var(--shadow-sm);
  transition: left 0.3s ease;
}
.metric-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 0.35rem;
}
.track-larson {
  background: linear-gradient(to right, var(--success) 0%, var(--warning) 40%, var(--error) 100%);
}
.track-caco3 {
  background: linear-gradient(to right, var(--error) 0%, var(--success) 50%, var(--error) 100%);
}
.track-caso4 {
  background: linear-gradient(to right, var(--success) 0%, var(--warning) 60%, var(--error) 100%);
}

/* --- Scale Inhibitor Cost Optimization Badges --- */
.advisor-cost-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 0.5rem;
  animation: fadeIn 0.2s ease;
}
.advisor-cost-badge i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.cost-savings {
  background: rgba(82, 178, 107, 0.08);
  border: 1px solid rgba(82, 178, 107, 0.25);
  color: var(--success);
}
.cost-expense {
  background: rgba(217, 79, 61, 0.08);
  border: 1px solid rgba(217, 79, 61, 0.25);
  color: var(--error);
}
.cost-optimized {
  background: rgba(0, 114, 151, 0.08);
  border: 1px solid rgba(0, 114, 151, 0.25);
  color: var(--secondary);
}

/* --- Upload Card --- */
.upload-card { padding: 0; overflow: hidden; }
.upload-instructions {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--gray-100);
}
.upload-instructions p { font-size: 0.9rem; color: var(--gray-600); margin-bottom: 0.5rem; }
.upload-zone-active {
  border-color: var(--secondary) !important;
  background: rgba(0,114,151,0.04) !important;
}

/* --- Table Mono --- */
.td-mono {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* --- Framework Card --- */
.framework-card {
  max-width: 800px;
}
.framework-card h3 {
  margin: 1.5rem 0 0.5rem;
  color: var(--gray-800);
}
.framework-card h3:first-child { margin-top: 0; }
.framework-card p {
  color: var(--gray-600);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.framework-card ol, .framework-card ul {
  margin: 0.5rem 0 1rem 1.25rem;
  color: var(--gray-600);
  line-height: 1.7;
}
.framework-card li { margin-bottom: 0.35rem; }
.framework-card code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--gray-100);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  color: var(--secondary);
}
.framework-card strong { color: var(--gray-800); }

/* --- Loading --- */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  min-height: 300px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 1rem;
}
.loading-overlay p {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--gray-500);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1024px) {
  .landing-features {
    grid-template-columns: 1fr;
    max-width: 480px;
  }
  .landing-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-4, .grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
  .diag-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 768px) {
  .landing-header {
    padding: 1rem 1.5rem;
  }
  .landing-hero {
    padding: 3rem 1.5rem 3rem;
  }
  .landing-hero h1 {
    font-size: 2rem;
  }
  .landing-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .sidebar {
    width: 100%;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  .main-content, .main-area {
    margin-left: 0;
  }
  .app-layout {
    flex-direction: column;
  }
  .grid-2, .grid-3, .grid-4, .grid-5 {
    grid-template-columns: 1fr;
  }
  .diag-grid {
    grid-template-columns: 1fr;
  }
  .column-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .arch-flow {
    flex-direction: column;
  }
  .arch-arrow {
    transform: rotate(90deg);
  }
}

/* --- Landing Framework Section --- */
.landing-framework {
  max-width: 1100px;
  margin: 0 auto 5rem;
  padding: 0 2rem;
}
.landing-framework-inner {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-sm);
}
.landing-framework h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}
.framework-subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: 1.05rem;
  max-width: 700px;
  margin: 0 auto 2rem;
}
.landing-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 2rem 1.75rem;
  text-align: left;
}
.card-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 114, 151, 0.08);
  margin-bottom: 1.25rem;
}
.card-header-icon i {
  color: var(--secondary);
  width: 22px;
  height: 22px;
}
.landing-card h3 {
  font-size: 1.25rem;
  color: var(--gray-900);
  margin-bottom: 1rem;
  margin-top: 0;
}
.landing-card p {
  color: var(--gray-600);
  font-size: 0.92rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}
.framework-list {
  margin: 0.75rem 0 0 1.25rem;
  padding: 0;
  color: var(--gray-600);
  font-size: 0.92rem;
  line-height: 1.65;
}
.framework-list li {
  margin-bottom: 0.75rem;
}
.framework-list li ul {
  margin: 0.35rem 0 0.5rem 1rem;
  list-style-type: circle;
}
.framework-list li ul li {
  margin-bottom: 0.25rem;
}
.framework-list code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--gray-200);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--secondary);
}

/* Corrections Grid */
.corrections-card {
  background: var(--gray-50);
}
.corrections-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.corrections-header h3 {
  margin: 0;
}
.corrections-grid {
  margin-top: 1.5rem;
}
.correction-item {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.correction-item h4 {
  font-size: 0.95rem;
  color: var(--secondary);
  margin-bottom: 0.5rem;
  font-weight: 700;
}
.correction-item p {
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin: 0;
}

/* --- Hero Button Outline --- */
.btn-hero-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  color: #fff;
  padding: 0.85rem 2.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.05rem;
  border: 2px solid rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.btn-hero-outline:hover {
  background: rgba(255,255,255,0.15);
  border-color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}
.btn-hero-outline i { width: 18px; height: 18px; }

/* ==========================================================
   DOCUMENTATION PAGE STYLES
   ========================================================== */
.docs-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}
.docs-header {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.docs-header-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.docs-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.docs-logo {
  height: 28px;
}
.docs-product-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
}
.docs-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.docs-sidebar {
  border-right: 1px solid var(--gray-200);
  background: var(--surface);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
  padding: 2rem 1.5rem;
}
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.docs-nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.docs-nav-section-title {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}
.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}
.docs-nav-link:hover {
  background: var(--gray-50);
  color: var(--secondary);
}
.docs-nav-link.active {
  background: rgba(0, 114, 151, 0.06);
  color: var(--secondary);
  font-weight: 600;
}
.docs-main {
  padding: 3rem 4rem;
  overflow-y: auto;
  background: var(--page-bg);
}
.docs-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 3.5rem 4rem;
  box-shadow: var(--shadow-sm);
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid var(--gray-200);
}
.docs-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem;
  color: var(--gray-500);
}
.docs-loading p {
  margin-top: 1rem;
  font-weight: 500;
}

/* --- Markdown Rendering Styles --- */
.markdown-body {
  color: var(--gray-700);
  line-height: 1.8;
  font-size: 1rem;
}
.markdown-body h1 {
  font-size: 2.2rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--gray-100);
  padding-bottom: 0.75rem;
}
.markdown-body h2 {
  font-size: 1.6rem;
  margin: 2.5rem 0 1.2rem;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 0.5rem;
  color: var(--secondary-dark);
}
.markdown-body h3 {
  font-size: 1.25rem;
  margin: 1.8rem 0 0.8rem;
  color: var(--gray-800);
}
.markdown-body p {
  margin-bottom: 1.25rem;
}
.markdown-body ul {
  list-style: none;
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}
.markdown-body ul li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.markdown-body ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--secondary);
  font-size: 1.2rem;
  line-height: 1;
  top: -1px;
}
.markdown-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}
.markdown-body ol li {
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
}
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--gray-100);
  color: var(--secondary-dark);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
}
.markdown-body pre {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-800);
  box-shadow: var(--shadow-md);
}
.markdown-body pre code {
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}
.markdown-body blockquote {
  border-left: 4px solid var(--secondary);
  background: rgba(0, 114, 151, 0.03);
  padding: 1.2rem 1.75rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: var(--shadow-sm);
}
.markdown-body blockquote p {
  margin-bottom: 0;
  font-style: italic;
  color: var(--gray-600);
}
.markdown-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.75rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.markdown-body th, .markdown-body td {
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  padding: 0.85rem 1.2rem;
  text-align: left;
}
.markdown-body th:last-child, .markdown-body td:last-child {
  border-right: none;
}
.markdown-body tr:last-child td {
  border-bottom: none;
}
.markdown-body th {
  background: rgba(0, 114, 151, 0.04);
  font-weight: 700;
  color: var(--gray-800);
  border-bottom: 2px solid var(--gray-200);
}
.markdown-body tr:nth-child(even) td {
  background: var(--gray-50);
}
.markdown-body tr:hover td {
  background: rgba(0, 114, 151, 0.02);
}
.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--gray-200);
  margin: 2.5rem 0;
}

.markdown-body .math-block {
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  font-family: var(--font-mono);
  text-align: center;
  font-size: 1.15rem;
  color: var(--secondary-dark);
  margin: 1.5rem 0;
  overflow-x: auto;
  font-weight: 500;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.markdown-body .math-block sub {
  bottom: -0.25em;
  font-size: 75%;
}
.markdown-body .math-block sup {
  top: -0.5em;
  font-size: 75%;
}

/* --- Docs Architecture Flow Diagram --- */
.docs-arch-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 2.5rem 0;
  padding: 2rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.docs-arch-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 600px;
}
.docs-arch-step {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  text-align: center;
  min-width: 180px;
  max-width: 260px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.docs-arch-step strong {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--secondary-dark);
}
.docs-arch-step small {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.3;
}
.docs-arch-arrow {
  font-size: 1.5rem;
  color: var(--gray-400);
  line-height: 1;
  font-weight: bold;
}
.docs-arch-step.state-passivated {
  border-left: 4px solid var(--success);
}
.docs-arch-step.state-active {
  border-left: 4px solid var(--warning);
}
.docs-arch-step.step-result {
  background: var(--gradient-horizontal);
  border: none;
}
.docs-arch-step.step-result strong {
  color: #fff;
}
.docs-arch-step.step-result small {
  color: rgba(255,255,255,0.9);
}

/* ================================================================
   Overview Tab: Selected-model blocks
   ================================================================ */

/* Badge row */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Individual inline badge */
.ps-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  background: transparent;
}
.ps-badge i {
  flex-shrink: 0;
}

/* NORSOK reference line */
.norsok-ref {
  font-size: 0.8rem;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-200);
  padding-top: 0.65rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Collapsible technical details */
.tech-details {
  margin-top: 0.65rem;
}
.tech-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 600;
  user-select: none;
  list-style: disclosure-closed;
  padding: 0.2rem 0;
}
.tech-details[open] summary {
  list-style: disclosure-open;
  margin-bottom: 0.4rem;
}
.tech-details p {
  font-size: 0.82rem;
  color: var(--gray-500);
  padding-left: 0.75rem;
  border-left: 2px solid var(--gray-200);
}

/* Inline warning text */
.warn {
  color: var(--warning);
  font-size: 0.83rem;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ==========================================================
   SCENARIO PANEL  (spec §6.4)
   ========================================================== */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.scenario-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.scenario-row:hover {
  background: rgba(0, 114, 151, 0.04);
  border-color: var(--gray-300);
}

.scenario-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-700);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenario-row-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* .btn-sm is already defined above (line 1505) — no duplicate needed */

/* ==========================================================
   MODEL TUNING TAB  (spec §6.4)
   ========================================================== */
.tuning-train-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-100);
}
.tuning-train-row .form-group { flex: 1 1 260px; max-width: 360px; margin-bottom: 0; }
.tuning-train-row .btn { margin-top: 1.6rem; }

.tuning-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
}

.tuning-status-running {
  background: rgba(0, 114, 151, 0.08);
  color: var(--secondary);
  border: 1px solid rgba(0, 114, 151, 0.2);
}

.tuning-status-error {
  background: rgba(217, 79, 61, 0.08);
  color: var(--error);
  border: 1px solid rgba(217, 79, 61, 0.2);
}

.tuning-result {
  padding: 1.25rem;
}

.tuning-result p {
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--gray-700);
}

.tuning-result .tech-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--gray-500);
  font-weight: 600;
}

.tuning-result .tech-details pre {
  margin-top: 0.5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

/* ── Auth: login gate + header badge ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  padding: 2.25rem 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  box-shadow: 0 10px 30px rgba(26, 45, 53, 0.10);
}
.login-card.login-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--primary-dark);
}
.login-brand h1 {
  margin: 0;
  font-size: 1.4rem;
  font-family: var(--font-header);
  color: var(--gray-800);
}
.login-sub {
  color: var(--gray-600, #5b6b72);
  margin: 0.35rem 0 1.5rem;
  font-weight: 300;
}
.login-card .form-group { margin-bottom: 1rem; }
.login-card .form-input { width: 100%; }
.login-error {
  color: #c0392b;
  font-size: 0.85rem;
  min-height: 1.1rem;
  margin: 0.25rem 0 0.5rem;
}
.login-btn { width: 100%; justify-content: center; }
.login-hint {
  color: var(--gray-500, #8a979d);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 1.25rem;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--gray-700, #2f4148);
  margin-right: 0.25rem;
}
.user-role {
  font-style: normal;
  background: var(--primary);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
  font-size: 0.72rem;
}

/* ── Admin views ── */
.admin-page { padding: 0.5rem 0.25rem; }
.admin-page > h3 { margin: 1.25rem 0 0.5rem; font-family: var(--font-header); color: var(--gray-800); }
.admin-tabs { display: flex; gap: 0.5rem; margin: 0.5rem 0 1rem; flex-wrap: wrap; }
.admin-tabs .admin-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
  padding: 0.9rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}
.admin-form .form-input { width: auto; min-width: 150px; flex: 0 1 auto; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.88rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--gray-200);
}
.admin-table th { color: var(--gray-700, #2f4148); font-weight: 600; }
.admin-empty { color: var(--gray-500, #8a979d); padding: 0.75rem 0; font-size: 0.88rem; }

/* Models catalog: per-row assign control + assigned-company chips */
.model-assign-cell { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.model-assign-co { width: auto; min-width: 120px; padding: 0.4rem 0.55rem; font-size: 0.82rem; }
.assign-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(0,114,151,0.08);
  color: var(--secondary);
  border-radius: 999px;
  padding: 0.15rem 0.3rem 0.15rem 0.6rem;
  font-size: 0.8rem;
  margin: 0.1rem 0.25rem 0.1rem 0;
}
.assign-chip button {
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}
.assign-chip button:hover { opacity: 1; }


/* Stale-results cue under Run Prediction. Predictions fire only from the
   button, so edited inputs would otherwise sit next to results describing the
   previous well with nothing to say so. */
.predict-stale-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.5rem;
  color: var(--warning);
  font-weight: 500;
  line-height: 1.35;
}
.predict-stale-hint i { flex-shrink: 0; margin-top: 0.15rem; }

/* Well schematic (Well Profile tab downhole profile): inline SVG column with
   a hover tooltip positioned inside .ws-wrap, plus a two-row legend. */
.well-schematic { margin: 0.5rem 0 0.75rem; }
.ws-wrap { position: relative; max-width: 620px; margin: 0 auto; }
.ws-wrap svg { display: block; width: 100%; height: auto; }
.ws-hit { cursor: crosshair; }
.ws-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--gray-800);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.45;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  z-index: 5;
}
.ws-legend {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.25rem 0 0.75rem;
  font-size: 0.74rem;
  color: var(--gray-600);
}
.ws-legend > div { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; }
.ws-legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.ws-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.ws-swatch-dot { border-radius: 50%; width: 9px; height: 9px; }
.ws-note { font-size: 0.78rem !important; color: var(--gray-500) !important; margin-top: 0.4rem; }

/* ==========================================================
   RESULTS PAGES — shared components
   White cards; risk carried by pill + dot + value colour only.
   No coloured side borders, no tinted card backgrounds.
   ========================================================== */
.ps-page { display: flex; flex-direction: column; gap: 1rem; }

.ps-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  min-width: 0;
}
.ps-card-title {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-heading); font-size: 0.9rem; font-weight: 600;
  color: var(--gray-700); margin-bottom: 0.75rem;
}
.ps-card-title i { width: 15px; height: 15px; color: var(--secondary); }

/* Status pill */
.ps-pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--gray-100); color: var(--gray-600);
}
.ps-pill.lvl-safe     { background: rgba(82, 178, 107, 0.13); color: #2f7d45; }
.ps-pill.lvl-moderate { background: rgba(232, 160, 32, 0.15); color: #946010; }
.ps-pill.lvl-high     { background: rgba(217, 79, 61, 0.12);  color: #b3382a; }
.ps-pill.lvl-severe   { background: rgba(127, 29, 29, 0.12);  color: var(--error-dark); }

/* Status dot */
.ps-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--gray-400); }
.ps-dot.lvl-safe     { background: var(--success); }
.ps-dot.lvl-moderate { background: var(--warning); }
.ps-dot.lvl-high     { background: var(--error); }
.ps-dot.lvl-severe   { background: var(--error-dark); }

/* Value colour */
.ps-value              { color: var(--gray-900); }
.ps-value.lvl-safe     { color: #2f7d45; }
.ps-value.lvl-moderate { color: #b7791f; }
.ps-value.lvl-high     { color: var(--error); }
.ps-value.lvl-severe   { color: var(--error-dark); }

/* Neutral meta badge (overrides the legacy coloured-border badge) */
.ps-badge { border: 1px solid var(--gray-200); border-radius: 999px; color: var(--gray-600); gap: 0.35rem; }

/* Status strip */
.ps-strip { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ps-strip-text { margin: 0; flex: 1; min-width: 200px; font-size: 0.92rem; color: var(--gray-700); line-height: 1.5; }

/* KPI tiles */
.ps-tiles { display: grid; gap: 0.75rem; }
.ps-tiles.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ps-tiles.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ps-tiles.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ps-tile { display: flex; flex-direction: column; gap: 0.2rem; text-align: left; font: inherit; color: inherit; width: 100%; }
.ps-tile-label {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500);
}
.ps-tile-value { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.ps-tile-value small { font-size: 0.8rem; font-weight: 500; color: var(--gray-500); }
.ps-tile-sub { font-size: 0.78rem; color: var(--gray-500); line-height: 1.4; }
.ps-tile-link { cursor: pointer; transition: var(--transition); }
.ps-tile-link:hover { border-color: var(--secondary); box-shadow: var(--shadow-sm); }
.ps-tile-link:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }
.ps-tile-go { margin-top: auto; padding-top: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--secondary); }

/* Overview headline */
.ps-headline { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.ps-rate { font-family: var(--font-heading); font-size: 2.8rem; font-weight: 700; line-height: 1; }
.ps-rate-label { margin-bottom: 0.4rem; }
.ps-rate small { font-size: 1rem; font-weight: 500; color: var(--gray-500); }
.ps-rate-ci { margin-top: 0.35rem; font-size: 0.78rem; color: var(--gray-500); }
.ps-headline-body { flex: 1; min-width: 240px; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.ps-headline-msg { margin: 0; font-size: 0.95rem; color: var(--gray-700); line-height: 1.5; }
.ps-headline .badge-row { margin-bottom: 0; }

/* Callout */
.ps-callout { display: flex; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap; }
.ps-callout-body { flex: 1; min-width: 220px; font-size: 0.88rem; color: var(--gray-700); line-height: 1.5; }
.ps-callout-body p { margin: 0 0 0.3rem; }
.ps-callout-body p:last-child { margin-bottom: 0; }

/* Grids */
.ps-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ps-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.ps-grid-rec { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: start; }

/* Charts */
.ps-chart-body { position: relative; }

/* Stacked section heading (Treatment) */
.ps-section {
  display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 0;
  font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; color: var(--gray-800);
}
.ps-section i { width: 18px; height: 18px; color: var(--secondary); }
.ps-section:not(:first-child) { border-top: 1px solid var(--gray-200); padding-top: 1.25rem; margin-top: 0.75rem; }

/* Method & assumptions drawer */
.method-drawer { padding: 0; }
.method-drawer summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.75rem 1.25rem; font-size: 0.85rem; font-weight: 600; color: var(--gray-600);
}
.method-drawer summary::-webkit-details-marker { display: none; }
.method-drawer summary::after { content: '▸'; margin-left: auto; transition: transform 0.2s ease; }
.method-drawer[open] summary::after { transform: rotate(90deg); }
.method-drawer summary i { width: 14px; height: 14px; color: var(--secondary); }
.method-drawer-body { padding: 0 1.25rem 1rem; font-size: 0.83rem; color: var(--gray-600); line-height: 1.6; }
.method-drawer-body p { margin: 0 0 0.6rem; }

/* Inline links and notes */
.ps-link { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--secondary); cursor: pointer; }
.ps-link:hover { text-decoration: underline; }
.ps-note { margin: 0; font-size: 0.85rem; color: var(--gray-500); }

/* Key/value list */
.ps-kv { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 0.87rem; }
.ps-kv dt { color: var(--gray-500); }
.ps-kv dd { margin: 0; color: var(--gray-800); font-weight: 600; }

/* Driver factor list */
.ps-factor-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.ps-factor { padding: 0.45rem 0; border-top: 1px solid var(--gray-100); }
.ps-factor-name { font-weight: 600; color: var(--gray-800); }
.ps-factor-val { font-family: var(--font-mono); font-weight: 600; margin-left: 0.4rem; }
.ps-factor-help { display: block; margin-top: 0.1rem; }

/* Treatment recommendation */
.ps-rec-dose { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; color: var(--gray-900); margin: 0.5rem 0 0.25rem; }
.ps-rec-dose small { font-size: 0.85rem; font-weight: 500; color: var(--gray-500); }
.ps-rec p { font-size: 0.88rem; color: var(--gray-600); line-height: 1.55; margin: 0 0 0.5rem; }
.ps-divider { border-top: 1px solid var(--gray-100); margin: 1rem 0; }
.ps-settings .form-group { margin-bottom: 1rem; }
.ps-settings .form-group:last-child { margin-bottom: 0; }

/* Brine index card */
.ps-index-value { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.ps-index-status { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; margin-top: 0.75rem; font-size: 0.82rem; color: var(--gray-600); line-height: 1.45; }

/* Materials table selected row */
.ps-row-selected td { font-weight: 600; }
.ps-row-selected td i { width: 14px; height: 14px; color: var(--secondary); vertical-align: -2px; }

@media (max-width: 1024px) {
  .ps-tiles.cols-4, .ps-tiles.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-grid-rec { grid-template-columns: minmax(0, 1fr); }
  .ps-grid-2, .ps-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .ps-tiles.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-grid-2, .ps-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .ps-rate { font-size: 2.2rem; }
  .ps-tile-value { font-size: 1.3rem; }
}
