/* ================================
   GLOBAL VARIABLES
================================ */
:root {
  --bg: #f5f5f7;
  --card-bg: #ffffff;
  --border: #e0e0e4;
  --text-main: #111827;
  --text-muted: #6b7280;
  --shadow-soft: 0 12px 30px rgba(15,23,42,0.08);
  --accent: #2563eb;
  --accent-light: #dbeafe;

  --var-color-1: #FF6B6B;
  --var-color-2: #4ECDC4;
  --var-color-3: #45B7D1;
  --var-color-4: #FFA07A;
  --var-color-5: #98D8C8;
  --var-color-6: #F4A261;
  --var-color-7: #9B59B6;
  --var-color-8: #3498DB;
  --var-color-9: #E74C3C;
  --var-color-10: #1ABC9C;
}

/* Dark Mode */
body.dark-mode {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --shadow-soft: 0 12px 30px rgba(0,0,0,0.3);
  --accent: #60a5fa;
  --accent-light: #1e3a5f;
}

/* ================================
   BASE
================================ */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  color: var(--text-main);
  transition: background-color 0.3s, color 0.3s;
}

/* ================================
   APP LAYOUT
================================ */
.app {
  max-width: 1200px;
  width: 100%;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
}

/* ================================
   SIDEBAR
================================ */
.sidebar {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 16px 14px 18px;
  height: fit-content;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 24px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
}

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

/* Dark Mode Toggle */
.dark-mode-toggle {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.dark-mode-toggle:hover {
  background: var(--border);
}

.dark-mode-toggle .sun-icon { display: inline; }
.dark-mode-toggle .moon-icon { display: none; }
body.dark-mode .dark-mode-toggle .sun-icon { display: none; }
body.dark-mode .dark-mode-toggle .moon-icon { display: inline; }

/* Search Box */
.search-box {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text-main);
  outline: none;
}

.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box::placeholder {
  color: var(--text-muted);
}

/* Sidebar Section Titles */
.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 12px;
  padding: 0 4px;
}

.badge {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Favorites List */
.favorites-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  max-height: 150px;
  overflow-y: auto;
}

.favorites-list .empty-message {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 8px;
}

/* ================================
   ACCORDION (Categories)
================================ */
.accordion-item {
  margin-bottom: 2px;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  text-align: left;
  transition: all 0.2s;
}

.accordion-header:hover {
  background: var(--border);
}

.accordion-header.active {
  background: var(--accent-light);
  color: var(--accent);
}

.accordion-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accordion-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 1px 5px;
  border-radius: 6px;
}

.accordion-arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.accordion-header.active .accordion-arrow {
  transform: rotate(90deg);
}

.accordion-content {
  list-style: none;
  padding: 4px 0 6px 6px;
  margin: 0;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

/* Equation List Items */
.eq-list-item {
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.eq-list-item:hover {
  background: #f3f4f6;
}

body.dark-mode .eq-list-item:hover {
  background: #334155;
}

.eq-list-item.active {
  background: #e5f0ff;
  border-left: 3px solid var(--accent);
}

body.dark-mode .eq-list-item.active {
  background: #1e3a5f;
}

.eq-list-item-title {
  font-weight: 500;
  color: var(--text-main);
}

.eq-list-item-cat {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.eq-list-item-meta {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.difficulty-badge {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
}

.difficulty-badge.basic { background: #d1fae5; color: #065f46; }
.difficulty-badge.intermediate { background: #fef3c7; color: #92400e; }
.difficulty-badge.advanced { background: #fee2e2; color: #991b1b; }

body.dark-mode .difficulty-badge.basic { background: #064e3b; color: #6ee7b7; }
body.dark-mode .difficulty-badge.intermediate { background: #78350f; color: #fcd34d; }
body.dark-mode .difficulty-badge.advanced { background: #7f1d1d; color: #fca5a5; }

.freq-badge { font-size: 0.75rem; }

/* ================================
   MAIN CARD
================================ */
.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
}

/* ================================
   HEADER
================================ */
.eq-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.eq-header-left { flex: 1; }

.eq-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eq-name {
  font-size: 1.3rem;
  font-weight: 600;
}

.eq-category {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.eq-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ================================
   UNITS TOGGLE
================================ */
.units-toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border);
}

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

.units-switch {
  position: relative;
  display: inline-block;
  width: 90px;
  height: 32px;
}

.units-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.units-slider {
  position: absolute;
  cursor: pointer;
  transition: 0.3s;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

input:checked + .units-slider {
  background: #3b82f6;
}

.units-slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 40px;
  left: 4px;
  bottom: 4px;
  background: white;
  transition: 0.3s;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  z-index: 2;
}

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

.units-slider .unit-text {
  position: relative;
  z-index: 1;
  transition: color 0.3s;
  color: white;
}

/* Favorite Toggle */
.favorite-toggle {
  font-size: 1.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-toggle:hover {
  background: var(--border);
}

.favorite-toggle.active {
  color: #f59e0b;
  background: #fef3c7;
  border-color: #fcd34d;
}

body.dark-mode .favorite-toggle.active {
  background: #78350f;
  border-color: #b45309;
}

/* ================================
   FORMULA
================================ */
.formula {
  font-size: 1.6rem;
  margin: 12px 0 10px;
  text-align: left;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  overflow-x: auto;
}

/* ================================
   INPUTS GRID
================================ */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.input-group,
.var-field {
  border-radius: 12px;
  border: 2px solid var(--border);
  padding: 10px 12px;
  background: var(--bg);
  position: relative;
}

.input-label,
.var-label {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  margin-bottom: 6px;
}

.var-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.1);
}

.var-symbol {
  font-size: 1.05rem;
  font-weight: 700;
}

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

.var-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.var-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 8px;
  margin-bottom: 3px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
}

.input-wrapper {
  position: relative;
  flex: 1;
  max-width: 180px;
}

.value-input,
.var-input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--card-bg);
  color: var(--text-main);
}

.value-input:focus,
.var-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.cell-input {
  width: 70px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--card-bg);
  color: var(--text-main);
  text-align: center;
  text-transform: uppercase;
}

.unit-inside {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* ================================
   CONSTANTS SECTION
================================ */
.constants-section {
  margin: 16px 0;
}

.constants-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.constants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.constant-item,
.const-field {
  border-radius: 12px;
  border: 2px solid #000;
  padding: 10px 12px;
  background: #f8f8f8;
  position: relative;
}

body.dark-mode .constant-item,
body.dark-mode .const-field {
  background: #334155;
  border-color: #64748b;
}

.constant-symbol,
.const-symbol {
  font-size: 1.05rem;
  font-weight: 700;
  color: #000;
}

body.dark-mode .constant-symbol,
body.dark-mode .const-symbol {
  color: #f1f5f9;
}

/* ================================
   RESULT SECTION
================================ */
.result-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 16px;
  background: #f0f9ff;
  border-radius: 12px;
  border: 2px solid #bae6fd;
}

body.dark-mode .result-section {
  background: #0c4a6e;
  border-color: #0369a1;
}

.result-label {
  font-size: 1rem;
  font-weight: 600;
  color: #075985;
}

body.dark-mode .result-label {
  color: #7dd3fc;
}

.result-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0c4a6e;
  font-family: 'Consolas', 'Monaco', monospace;
}

body.dark-mode .result-value {
  color: #e0f2fe;
}

/* ================================
   EXCEL FORMULA SECTION
================================ */
.excel-formula-wrapper {
  margin-top: 12px;
  padding: 12px 14px;
  background: #eff6ff;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

body.dark-mode .excel-formula-wrapper {
  background: #1e3a5f;
  border-color: #1d4ed8;
}

.excel-formula-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 6px;
}

body.dark-mode .excel-formula-header {
  color: #93c5fd;
}

.excel-formula {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  color: #1e40af;
  word-break: break-all;
  background: white;
  padding: 8px 10px;
  border-radius: 6px;
  display: block;
}

body.dark-mode .excel-formula {
  background: #0f172a;
  color: #93c5fd;
}

/* ================================
   SOLVE FOR SECTION
================================ */
.solve-for-section {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.solve-for-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.solve-for-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.solve-for-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.solve-for-var {
  font-weight: 600;
  min-width: 50px;
  color: var(--accent);
}

.solve-for-formula {
  flex: 1;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  overflow-x: auto;
}

.copy-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
}

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

/* ================================
   LOOKUP TABLE SECTION
================================ */
.lookup-table-section {
  margin-top: 16px;
  padding: 14px;
  background: #f3f4f6;
  border-radius: 12px;
  border: 1px solid #d1d5db;
}

body.dark-mode .lookup-table-section {
  background: #334155;
  border-color: #475569;
}

.lookup-table-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
}

body.dark-mode .lookup-table-header {
  color: #e5e7eb;
}

.lookup-table-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lookup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: white;
  border: 2px solid #9ca3af;
}

body.dark-mode .lookup-table {
  background: #1e293b;
  border-color: #475569;
}

.lookup-table th,
.lookup-table td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #9ca3af;
}

body.dark-mode .lookup-table th,
body.dark-mode .lookup-table td {
  border-color: #475569;
}

.lookup-table th {
  background: #e5e7eb;
  font-weight: 600;
  color: #1f2937;
}

body.dark-mode .lookup-table th {
  background: #475569;
  color: #f1f5f9;
}

.lookup-table tr:hover td {
  background: #dbeafe;
}

body.dark-mode .lookup-table tr:hover td {
  background: #1e3a5f;
}

/* ================================
   EXAMPLES SECTION
================================ */
.examples-section {
  margin-top: 16px;
  padding: 14px;
  background: #f0fdf4;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
}

body.dark-mode .examples-section {
  background: #14532d;
  border-color: #166534;
}

.examples-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #166534;
  margin-bottom: 12px;
}

body.dark-mode .examples-header {
  color: #86efac;
}

.example-item {
  background: white;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid #86efac;
}

body.dark-mode .example-item {
  background: #1e293b;
  border-color: #166534;
}

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

.example-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.example-problem,
.example-given,
.example-solution {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.example-solution pre {
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  font-family: 'Consolas', 'Monaco', monospace;
  margin: 6px 0 0;
}

.example-answer {
  font-size: 0.9rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.answer-value {
  font-weight: 700;
  color: #16a34a;
}

body.dark-mode .answer-value {
  color: #4ade80;
}

/* ================================
   EXAM TIP SECTION
================================ */
.exam-tip-section {
  margin-top: 16px;
  padding: 14px;
  background: #fffbeb;
  border-radius: 12px;
  border: 1px solid #fde68a;
}

body.dark-mode .exam-tip-section {
  background: #78350f;
  border-color: #b45309;
}

.exam-tip-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}

body.dark-mode .exam-tip-header {
  color: #fcd34d;
}

.exam-tip-section p {
  margin: 0;
  font-size: 0.9rem;
  color: #78350f;
  line-height: 1.5;
}

body.dark-mode .exam-tip-section p {
  color: #fef3c7;
}

/* ================================
   COMMON MISTAKES SECTION
================================ */
.common-mistakes-section {
  margin-top: 16px;
  padding: 14px;
  background: #fef2f2;
  border-radius: 12px;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
}

body.dark-mode .common-mistakes-section {
  background: #7f1d1d;
  border-color: #991b1b;
}

.common-mistakes-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 8px;
}

body.dark-mode .common-mistakes-header {
  color: #fca5a5;
}

.common-mistakes-section ul {
  margin: 0;
  padding-left: 18px;
}

.common-mistakes-section li {
  font-size: 0.88rem;
  color: #991b1b;
  margin-bottom: 4px;
}

body.dark-mode .common-mistakes-section li {
  color: #fecaca;
}

/* ================================
   STEPS SECTION
================================ */
.steps-section {
  margin-top: 16px;
  padding: 14px;
  background: #fffbeb;
  border-radius: 12px;
  border: 1px solid #fde68a;
}

.steps-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #92400e;
}

.step-item {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: white;
  border-radius: 8px;
  font-size: 0.9rem;
}

body.dark-mode .step-item {
  background: #1e293b;
}

.step-num,
.step-number {
  font-weight: 600;
  color: #b45309;
  margin-right: 6px;
}

/* ================================
   SIMPLE EXCEL FORMULA (Green)
================================ */
.simple-excel-wrapper {
  margin-top: 12px;
  padding: 14px;
  background: #f0fdf4;
  border-radius: 12px;
  border: 1px solid #bbf7d0;
}

body.dark-mode .simple-excel-wrapper {
  background: #14532d;
  border-color: #166534;
}

.simple-excel-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #166534;
  margin-bottom: 8px;
}

body.dark-mode .simple-excel-header {
  color: #86efac;
}

.simple-excel-wrapper .excel-formula {
  background: #ffffff;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #86efac;
  margin-bottom: 12px;
  word-break: break-all;
  white-space: normal;
  color: #14532d;
}

body.dark-mode .simple-excel-wrapper .excel-formula {
  background: #1e293b;
  border-color: #166534;
  color: #86efac;
}

/* ================================
   COEFFICIENT TABLE
================================ */
.coeff-table-wrapper {
  margin-top: 12px;
  padding: 14px;
  background: #f3f4f6;
  border-radius: 12px;
  border: 1px solid #d1d5db;
}

body.dark-mode .coeff-table-wrapper {
  background: #334155;
  border-color: #475569;
}

.coeff-table-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
}

body.dark-mode .coeff-table-header {
  color: #e5e7eb;
}

.coeff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #ffffff;
  border: 2px solid #9ca3af;
}

body.dark-mode .coeff-table {
  background: #1e293b;
  border-color: #475569;
}

.coeff-table th,
.coeff-table td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #9ca3af;
}

body.dark-mode .coeff-table th,
body.dark-mode .coeff-table td {
  border-color: #475569;
}

.coeff-table th {
  background: #e5e7eb;
  font-weight: 600;
  color: #1f2937;
  border-bottom: 2px solid #6b7280;
}

body.dark-mode .coeff-table th {
  background: #475569;
  color: #f1f5f9;
}

.coeff-table td:first-child {
  background: #f9fafb;
  font-weight: 500;
}

body.dark-mode .coeff-table td:first-child {
  background: #334155;
}

.coeff-table td:last-child {
  font-family: Consolas, 'Courier New', monospace;
  text-align: center;
  font-weight: 600;
}

.coeff-table tr:hover td {
  background: #dbeafe;
}

body.dark-mode .coeff-table tr:hover td {
  background: #1e3a5f;
}

.coeff-table-note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  padding: 6px 10px;
  background: #e5e7eb;
  border-radius: 6px;
  border-left: 3px solid #9ca3af;
}

body.dark-mode .coeff-table-note {
  background: #475569;
  color: #cbd5e1;
}

/* ================================
   BUTTONS
================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-outline {
  background: transparent;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-cef {
  background: #3b82f6;
  color: white;
  border: none;
}

.btn-cef:hover {
  background: #2563eb;
}

.btn-csf {
  background: #22c55e;
  color: white;
  border: none;
}

.btn-csf:hover {
  background: #16a34a;
}

/* ================================
   FEEDBACK SECTION
================================ */
.eq-feedback-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.eq-feedback-panel {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.eq-feedback-panel h3 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.eq-feedback-panel label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.eq-feedback-panel input,
.eq-feedback-panel textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.9rem;
}

.eq-feedback-panel textarea {
  min-height: 80px;
  resize: vertical;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

#eqFeedbackStatus {
  margin-left: auto;
  font-size: 0.85rem;
}

/* ================================
   FOOTER
================================ */
.footer {
  margin-top: 32px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer p {
  margin: 4px 0;
}

.footer-note {
  font-size: 0.75rem;
}

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 800px) {
  body {
    padding: 12px;
  }
  
  .app {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
    max-height: none;
  }
  
  .card {
    padding: 16px;
  }
  
  .eq-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .eq-header-right {
    width: 100%;
    justify-content: space-between;
  }
  
  .inputs-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================
   SCROLLBAR
================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-main);
}

/* ================================
   PRINT
================================ */
@media print {
  .sidebar,
  .dark-mode-toggle,
  .favorite-toggle,
  .eq-feedback-section,
  .footer,
  .btn {
    display: none !important;
  }
  
  body {
    padding: 0;
    background: white;
  }
  
  .card {
    box-shadow: none;
  }
}
