/* ============================================
   FISCAL PLANNER - STYLES
   Green accent theme for finance/money
   ============================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  line-height: 1.5;
  padding: 1rem;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   NAVIGATION (matches Economy Generator)
   ============================================ */
.micras-tool-nav {
  background: #293241;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 40px;
  font-size: 0.85rem;
  gap: 0.5rem;
  position: relative;
  z-index: 100;
  margin: -1rem -1rem 1rem -1rem;
}

.micras-tool-nav a {
  color: #ffffff;
  text-decoration: none;
  transition: color 0.2s;
}

.micras-tool-nav a:hover {
  text-decoration: underline;
}

.micras-tool-nav .micras-tool-nav-sep {
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0.25rem;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #1e293b;
  color: white;
  padding: 0.5rem 1rem;
  z-index: 101;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* Screen-reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators for keyboard navigation */
a:focus-visible,
button:focus-visible,
.tab-btn:focus-visible,
.mode-btn:focus-visible,
.header-btn:focus-visible,
.tooltip-trigger:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}

select:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 1px;
}

/* ============================================
   HEADER — green gradient
   ============================================ */
.header {
  background: linear-gradient(to right, #14532d, #166534);
  color: white;
  padding: 1.5rem;
  border-radius: 0.5rem 0.5rem 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.header p {
  color: #bbf7d0;
  margin-top: 0.25rem;
  font-size: 0.9rem;
}

.flex-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.header-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #bbf7d0;
  padding: 0.4rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.header-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
  color: white;
}

/* ============================================
   INTRO BOX — green tint
   ============================================ */
.intro-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0 0 0.5rem 0.5rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: #14532d;
  margin-bottom: 0;
}

.intro-box a {
  color: #15803d;
}

.intro-box strong {
  color: #166534;
}

/* ============================================
   MAIN LAYOUT — tabs left, sidebar right
   ============================================ */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

@media (max-width: 1023px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TAB NAVIGATION
   ============================================ */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  background: white;
  border-radius: 0.5rem 0.5rem 0 0;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: #15803d;
}

.tab-btn.active {
  color: #166534;
  border-bottom-color: #16a34a;
  font-weight: 600;
}

/* ============================================
   TAB PANELS
   ============================================ */
.tab-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  padding: 1.25rem;
}

.tab-panel[hidden] {
  display: none;
}

/* ============================================
   PANEL SECTIONS
   ============================================ */
.panel-section {
  margin-bottom: 1.25rem;
}

.panel-section:last-child {
  margin-bottom: 0;
}

.panel-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.panel-section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

/* ============================================
   INPUT GROUPS
   ============================================ */
.input-group {
  margin-bottom: 0.75rem;
}

.inputs-grid .input-group {
  margin-bottom: 0;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.label-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem 1rem;
}

.inputs-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 700px) {
  .inputs-grid:not(.inputs-grid-2) {
    grid-template-columns: repeat(4, 1fr);
  }
}

input[type="text"],
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  color: #1f2937;
  background: white;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

input[type="text"]::placeholder {
  color: #9ca3af;
}

input[type="text"].input-error,
select.input-error {
  border-color: #ef4444;
}

.input-error-msg {
  color: #dc2626;
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

.preset-row {
  margin-bottom: 0.75rem;
}

/* ============================================
   IMPORT ROW
   ============================================ */
.import-row {
  display: flex;
  gap: 0.5rem;
}

.import-row input {
  flex: 1;
}

.import-status {
  font-size: 0.8rem;
  margin-top: 0.375rem;
  min-height: 1.2em;
}

.import-status.success {
  color: #16a34a;
}

.import-status.error {
  color: #dc2626;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-accent {
  background: #16a34a;
  color: white;
}

.btn-accent:hover {
  background: #15803d;
}

.btn-muted {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.btn-muted:hover {
  background: #e5e7eb;
  color: #374151;
}

/* ============================================
   TOOLTIPS (matches Economy Generator)
   ============================================ */
.tooltip-trigger {
  background: #e5e7eb;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #6b7280;
  cursor: help;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tooltip-content {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: -8px;
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  width: 250px;
  max-width: calc(100vw - 2rem);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}

.tooltip-content.tooltip-below {
  bottom: auto;
  top: calc(100% + 8px);
}

.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus .tooltip-content,
.tooltip-trigger.tooltip-open .tooltip-content {
  display: block;
}

/* ============================================
   BADGES (plausibility indicators)
   ============================================ */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-small {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.badge-yellow {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-neutral {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-bottom: 1px solid #bbf7d0;
  border-radius: 0.5rem 0.5rem 0 0;
}

.sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #14532d;
}

/* Sidebar highlight block */
.sidebar-highlight {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-bottom: 1px solid #bbf7d0;
  padding: 0.75rem 1rem;
  text-align: center;
}

.sidebar-highlight-label {
  display: block;
  font-size: 0.75rem;
  color: #15803d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-highlight-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #14532d;
}

/* Sidebar sections */
.sidebar-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

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

.sidebar-label {
  color: #6b7280;
}

.sidebar-value {
  font-weight: 600;
  color: #1f2937;
}

.sidebar-row-highlight {
  margin-top: 0.25rem;
  padding-top: 0.375rem;
  border-top: 1px solid #e5e7eb;
}

.sidebar-row-highlight .sidebar-value {
  font-size: 0.9rem;
}

/* Balance color states */
.sidebar-value.balance-surplus {
  color: #16a34a;
}

.sidebar-value.balance-deficit {
  color: #dc2626;
}

.sidebar-value.balance-balanced {
  color: #6b7280;
}

/* Spending mini bar chart */
.spending-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  font-size: 0.75rem;
}

.spending-bar-label {
  width: 90px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.spending-bar-track {
  flex: 1;
  height: 10px;
  background: #f3f4f6;
  border-radius: 5px;
  overflow: hidden;
}

.spending-bar-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 5px;
  transition: width 0.3s;
}

.spending-bar-pct {
  width: 36px;
  text-align: right;
  font-weight: 500;
  color: #374151;
  flex-shrink: 0;
}

/* Health & plausibility check items */
.check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.78rem;
  cursor: help;
}

.check-item[title]:hover {
  background: #f3f4f6;
  border-radius: 4px;
}

.check-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.check-icon-green { background: #16a34a; }
.check-icon-yellow { background: #eab308; }
.check-icon-red { background: #dc2626; }

.check-label {
  color: #4b5563;
}

/* Plausibility badge inline with section title */
.sidebar-section-title .badge {
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* Preset health context note */
.sidebar-preset-context {
  font-size: 0.72rem;
  color: #6b7280;
  font-style: italic;
  padding: 0.3rem 0.5rem;
  margin-top: 0.3rem;
  border-left: 2px solid #d1d5db;
  line-height: 1.3;
}

/* ============================================
   REVENUE / SPENDING SLIDERS
   ============================================ */

/* Mode toggle (Simple / Advanced) */
.revenue-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mode-toggle {
  display: flex;
  background: #f3f4f6;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid #d1d5db;
}

.mode-btn {
  padding: 0.35rem 0.85rem;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: #16a34a;
  color: white;
}

.mode-btn:hover:not(.active) {
  background: #e5e7eb;
}

/* Revenue total indicator */
.revenue-total {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.revenue-total-label {
  color: #6b7280;
  font-weight: 500;
}

.revenue-total-value {
  font-weight: 700;
  color: #1f2937;
  min-width: 50px;
  text-align: right;
}

.revenue-total-value.over { color: #dc2626; }
.revenue-total-value.under { color: #d97706; }
.revenue-total-value.exact { color: #16a34a; }

/* Total progress bar */
.revenue-total-bar-container {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.revenue-total-bar {
  height: 100%;
  background: #16a34a;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}

.revenue-total-bar.over { background: #dc2626; }
.revenue-total-bar.under { background: #d97706; }

/* Spending controls (mirrors revenue-controls) */
.spending-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Spending total indicator */
.spending-total {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.spending-total-label {
  color: #6b7280;
  font-weight: 500;
}

.spending-total-value {
  font-weight: 700;
  color: #1f2937;
  min-width: 50px;
  text-align: right;
}

.spending-total-value.over { color: #dc2626; }
.spending-total-value.under { color: #d97706; }
.spending-total-value.exact { color: #16a34a; }

/* Spending total progress bar */
.spending-total-bar-container {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.spending-total-bar {
  height: 100%;
  background: #16a34a;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}

.spending-total-bar.over { background: #dc2626; }
.spending-total-bar.under { background: #d97706; }

/* Locked slider row (debt service) */
.slider-row.locked {
  opacity: 0.65;
}

.slider-row.locked .slider-range,
.slider-row.locked .slider-pct-input {
  pointer-events: none;
  cursor: default;
}

/* Tiny badge for auto indicator */
.badge-tiny {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.05rem 0.3rem;
  border-radius: 0.2rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-muted {
  background: #e5e7eb;
  color: #6b7280;
}

/* Rename button & input */
.rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #9ca3af;
  padding: 0 0.15rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.slider-row:hover .rename-btn {
  opacity: 1;
}

.rename-btn:hover {
  color: #16a34a;
}

.rename-input {
  width: 130px;
  padding: 0.15rem 0.3rem;
  border: 1px solid #16a34a;
  border-radius: 0.2rem;
  font-size: 0.8rem;
  outline: none;
}

/* Slider actions row */
.slider-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.slider-actions-hint {
  font-size: 0.78rem;
  color: #9ca3af;
  font-style: italic;
}

/* Slider container */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* Individual slider row */
.slider-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px 90px;
  gap: 0.625rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: 0.25rem;
  transition: background 0.15s;
}

.slider-row:hover {
  background: #f9fafb;
}

.slider-row.hidden {
  display: none;
}

.slider-label {
  font-size: 0.82rem;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Range input styling */
.slider-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #16a34a;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #16a34a;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.slider-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

/* Percentage text input in slider row */
.slider-pct-input {
  width: 60px;
  padding: 0.25rem 0.375rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.82rem;
  text-align: right;
  color: #1f2937;
  background: white;
}

.slider-pct-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

/* Amount display */
.slider-amount {
  font-size: 0.78rem;
  color: #6b7280;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Slider row in grouped "Other" mode */
.slider-row-grouped {
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  padding-left: calc(0.5rem + 3px);
}

/* Responsive slider adjustments */
@media (max-width: 767px) {
  .slider-row {
    grid-template-columns: 1fr 60px;
    gap: 0.375rem;
    padding: 0.5rem;
  }

  .slider-range {
    grid-column: 1 / -1;
  }

  .slider-amount {
    display: none;
  }

  .revenue-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .revenue-total {
    justify-content: center;
  }

  .spending-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .spending-total {
    justify-content: center;
  }
}

/* ============================================
   METHODOLOGY SECTION (matches Economy Generator)
   ============================================ */
.methodology-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.methodology-section summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  font-size: 0.95rem;
}

.methodology-section summary:hover {
  background: #f9fafb;
}

.methodology-content {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.6;
}

/* ============================================
   COPY FEEDBACK TOAST
   ============================================ */
.copy-feedback-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #166534;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.copy-feedback-toast.visible {
  opacity: 1;
}

.copy-feedback-toast.toast-error {
  background: #991b1b;
}

/* ============================================
   PROJECTIONS TAB
   ============================================ */

/* Projection inputs grid (4 columns on wide, 2 on medium) */
.inputs-grid-proj {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem 1rem;
}

@media (min-width: 700px) {
  .inputs-grid-proj {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Per-category trend overrides */
.category-trends-section {
  margin-top: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
}

.category-trends-section summary {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
}

.category-trends-section summary:hover {
  background: #f9fafb;
}

.category-trends-hint {
  padding: 0 0.75rem 0.5rem;
  font-size: 0.78rem;
  color: #9ca3af;
  font-style: italic;
}

.category-trend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.375rem 0.75rem;
  padding: 0 0.75rem 0.75rem;
}

@media (min-width: 700px) {
  .category-trend-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-trend-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.category-trend-label {
  font-size: 0.78rem;
  color: #6b7280;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-trend-input {
  width: 65px;
  padding: 0.25rem 0.375rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.82rem;
  text-align: right;
  color: #1f2937;
  background: white;
  flex-shrink: 0;
}

.category-trend-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.category-trend-input::placeholder {
  color: #d1d5db;
}

.category-trend-unit {
  font-size: 0.75rem;
  color: #9ca3af;
  flex-shrink: 0;
}

/* Projection button and hint */
.projection-hint {
  font-size: 0.82rem;
  color: #16a34a;
  margin-left: 0.75rem;
  font-style: italic;
}

/* Projection results area */
.projection-results {
  margin-top: 0.5rem;
}

/* Projection table */
.projection-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.projection-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.projection-table th,
.projection-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.projection-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.projection-table th.num,
.projection-table td.num {
  text-align: right;
}

.projection-table tr.base-row {
  background: #f0fdf4;
}

.projection-table tr:hover:not(.base-row) {
  background: #f9fafb;
}

.base-tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.05rem 0.35rem;
  border-radius: 0.2rem;
  background: #dcfce7;
  color: #166534;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.projection-table .surplus {
  color: #16a34a;
}

.projection-table .deficit {
  color: #dc2626;
}

/* SVG Charts */
.projection-chart-header {
  margin-top: 1.25rem;
}

.projection-chart-wrap {
  margin-bottom: 1rem;
}

.projection-chart {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: white;
}

/* Sustainability warnings */
.sustainability-warnings {
  padding: 0.25rem 0;
}

/* ============================================
   EXPORT TAB
   ============================================ */

.export-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.export-chart-col h4 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem 0;
  color: #333;
}

.pie-chart-wrap {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.pie-chart {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

.pie-legend-label {
  color: #555;
  white-space: nowrap;
}

.pie-legend-value {
  color: #888;
  font-size: 0.72rem;
  margin-left: auto;
  white-space: nowrap;
}

.export-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-export {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-export:hover {
  background: #1b5e20;
}

.btn-export:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.25rem 0.625rem;
  font-size: 0.78rem;
  background: #e0e0e0;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

.btn-small:hover {
  background: #bdbdbd;
}

.export-preview {
  margin-top: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  overflow: hidden;
}

.export-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
}

.export-preview pre {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 300px;
  background: #fafafa;
  white-space: pre-wrap;
  word-break: break-word;
}

.export-preview textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  border: none;
  border-top: none;
  resize: vertical;
  background: #fafafa;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1023px) {
  .sidebar {
    position: static;
  }
}

@media (max-width: 767px) {
  body {
    padding: 0.5rem;
  }

  .micras-tool-nav {
    margin: -0.5rem -0.5rem 0.75rem -0.5rem;
    padding: 0 0.75rem;
    font-size: 0.8rem;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 0.375rem 0.375rem 0 0;
  }

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

  .flex-row {
    width: 100%;
  }

  .header-btn {
    flex: 1;
    text-align: center;
  }

  .intro-box {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    border-radius: 0 0 0.375rem 0.375rem;
  }

  .tab-nav {
    border-radius: 0.375rem 0.375rem 0 0;
  }

  .tab-btn {
    padding: 0.625rem 0.75rem;
    font-size: 0.82rem;
  }

  .tab-panel {
    padding: 1rem;
    border-radius: 0 0 0.375rem 0.375rem;
  }

  .inputs-grid,
  .inputs-grid-2 {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  input[type="text"],
  select {
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
  }

  .tooltip-content {
    width: 200px;
    right: -4px;
  }

  .tooltip-trigger {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .import-row {
    flex-direction: column;
  }

  .inputs-grid-proj {
    grid-template-columns: 1fr;
  }

  .category-trend-grid {
    grid-template-columns: 1fr;
  }

  .projection-table {
    font-size: 0.78rem;
  }

  .projection-table th,
  .projection-table td {
    padding: 0.375rem 0.5rem;
  }

  .export-charts-row {
    grid-template-columns: 1fr;
  }

  .pie-chart-wrap {
    flex-direction: column;
    align-items: center;
  }

  .export-btn-group {
    flex-direction: column;
  }

  .btn-export {
    width: 100%;
    text-align: center;
  }
}
