/* ============================================================
   CSS VARIABLES & THEME SYSTEM
   ============================================================ */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --transition: 0.2s ease;
  --max-width: 1400px;
}

[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1e2e;
  --bg-card-hover: #22253a;
  --bg-input: #1a1c2b;
  --bg-input-focus: #20233a;
  --bg-table-header: #1e2036;
  --bg-table-row-alt: #181a28;
  --bg-table-row-hover: #252840;
  --bg-center-point: rgba(99, 102, 241, 0.1);
  --bg-toast: #2d3048;
  --bg-tooltip: #2a2d44;
  --bg-badge: rgba(99, 102, 241, 0.15);
  --text-primary: #e8eaf0;
  --text-secondary: #9da3b4;
  --text-tertiary: #6b7185;
  --text-on-accent: #ffffff;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-green: #22c55e;
  --accent-green-soft: rgba(34, 197, 94, 0.12);
  --accent-amber: #f59e0b;
  --accent-amber-soft: rgba(245, 158, 11, 0.12);
  --accent-red: #ef4444;
  --accent-red-soft: rgba(239, 68, 68, 0.12);
  --border: #2a2d40;
  --border-focus: #6366f1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --scrollbar-track: #1a1c2b;
  --scrollbar-thumb: #3a3d55;
}

[data-theme="light"] {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ecedf3;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #f0f1f5;
  --bg-input-focus: #e8e9f0;
  --bg-table-header: #f0f1f8;
  --bg-table-row-alt: #f8f9fc;
  --bg-table-row-hover: #eef0f7;
  --bg-center-point: rgba(99, 102, 241, 0.06);
  --bg-toast: #ffffff;
  --bg-tooltip: #1e2036;
  --bg-badge: rgba(99, 102, 241, 0.08);
  --text-primary: #1a1c2e;
  --text-secondary: #5a5f73;
  --text-tertiary: #8b90a0;
  --text-on-accent: #ffffff;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-green: #16a34a;
  --accent-green-soft: rgba(22, 163, 74, 0.08);
  --accent-amber: #d97706;
  --accent-amber-soft: rgba(217, 119, 6, 0.08);
  --accent-red: #dc2626;
  --accent-red-soft: rgba(220, 38, 38, 0.08);
  --border: #dfe1ea;
  --border-focus: #6366f1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --scrollbar-track: #f0f1f5;
  --scrollbar-thumb: #c5c8d5;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

::selection {
  background: var(--accent);
  color: var(--text-on-accent);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: -2px;
}

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

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.app-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 70px);
}

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

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

@media (max-width: 480px) {
  .app-main { padding: 1rem; gap: 1rem; }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 1rem; }

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .icon {
  font-size: 1rem;
  opacity: 0.7;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
}

input:focus, select:focus, textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input.invalid, select.invalid {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-soft);
}

.validation-msg {
  font-size: 0.75rem;
  color: var(--accent-red);
  margin-top: 0.25rem;
  display: none;
}

.validation-msg.visible { display: block; }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%239da3b4' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

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

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border-color: var(--accent-red-soft);
}

.btn-danger:hover {
  background: var(--accent-red-soft);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
  width: 28px;
  height: 28px;
}

.btn-block {
  width: 100%;
}

.btn-generate {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: white;
  border: none;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-generate:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-generate:active {
  transform: translateY(0) scale(0.98);
}

/* ============================================================
   DOE TYPE SELECTOR
   ============================================================ */
.doe-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.doe-type-btn {
  padding: 0.6rem 0.7rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  font-family: var(--font-sans);
}

.doe-type-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-tertiary);
}

.doe-type-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.doe-type-btn .doe-type-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.1rem;
}

.doe-type-btn .doe-type-desc {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  line-height: 1.3;
}

.doe-type-btn.active .doe-type-name { color: var(--accent); }

/* ============================================================
   FACTOR BUILDER
   ============================================================ */
.factor-row {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.6rem;
  transition: all var(--transition);
  position: relative;
}

.factor-row:hover {
  border-color: var(--text-tertiary);
}

.factor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.factor-name-input {
  font-weight: 600;
  font-size: 0.9rem;
  background: transparent !important;
  border: none !important;
  padding: 0.2rem 0 !important;
  color: var(--text-primary);
  outline: none;
  box-shadow: none !important;
  border-bottom: 1px dashed var(--border) !important;
  border-radius: 0 !important;
  width: auto;
  min-width: 80px;
  max-width: 160px;
}

.factor-name-input:focus {
  border-bottom-color: var(--accent) !important;
}

.factor-actions {
  display: flex;
  gap: 0.3rem;
}

.factor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.factor-fields.categorical {
  grid-template-columns: 1fr;
}

.factor-type-toggle {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}

.factor-type-toggle button {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.factor-type-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.field-group label {
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
}

.field-group input, .field-group select {
  padding: 0.4rem 0.55rem;
  font-size: 0.82rem;
}

/* ============================================================
   CONFIG PANEL
   ============================================================ */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.config-grid .field-group.full-width {
  grid-column: 1 / -1;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.toggle-row label {
  margin-bottom: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

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

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

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition);
}

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

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

/* ============================================================
   PRESETS
   ============================================================ */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
}

.preset-btn {
  padding: 0.55rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: all var(--transition);
}

.preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.preset-btn .preset-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.preset-btn .preset-detail {
  font-size: 0.68rem;
  color: var(--text-tertiary);
}

/* ============================================================
   SUMMARY CARD
   ============================================================ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

.summary-item {
  text-align: center;
  padding: 0.7rem 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.summary-value.text-sm {
  font-size: 0.95rem;
}

.summary-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

/* ============================================================
   RESULTS TABLE
   ============================================================ */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.table-search {
  flex: 1;
  min-width: 140px;
}

.table-search input {
  padding: 0.45rem 0.65rem 0.45rem 2rem;
  font-size: 0.82rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239da3b4' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.65rem center;
}

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 600px;
  overflow-y: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.results-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.results-table th {
  background: var(--bg-table-header);
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--transition);
}

.results-table th:hover {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.results-table th .sort-icon {
  margin-left: 0.3rem;
  opacity: 0.4;
  font-size: 0.7rem;
}

.results-table th.sorted .sort-icon { opacity: 1; color: var(--accent); }

.results-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: background var(--transition);
}

.results-table tbody tr:nth-child(even) td {
  background: var(--bg-table-row-alt);
}

.results-table tbody tr:hover td {
  background: var(--bg-table-row-hover);
}

.results-table tbody tr.center-point td {
  background: var(--bg-center-point);
}

.results-table td:first-child {
  color: var(--text-tertiary);
  font-weight: 500;
  font-family: var(--font-sans);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

.pagination button {
  min-width: 32px;
  height: 32px;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  transition: all var(--transition);
}

.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.pagination-info {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin: 0 0.5rem;
}

/* ============================================================
   EXPORT TOOLBAR
   ============================================================ */
.export-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-toast);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent); }

.toast-icon { font-size: 1rem; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* ============================================================
   WARNING BANNER
   ============================================================ */
.warning-banner {
  background: var(--accent-amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: var(--accent-amber);
  margin-bottom: 0.75rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.4;
}

.warning-banner.visible { display: flex; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 300px;
  margin: 0 auto;
}

/* ============================================================
   BADGE
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--bg-badge);
  color: var(--accent);
}

/* ============================================================
   TOOLTIP
   ============================================================ */
.info-tip {
  position: relative;
  display: inline-flex;
  cursor: help;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.info-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tooltip);
  color: #e8eaf0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

/* ============================================================
   DOE INFO DESCRIPTIONS
   ============================================================ */
.doe-info {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .app-header, .left-panel, .table-toolbar, .export-bar,
  .pagination, .summary-grid, .toast-container { display: none !important; }
  .app-main { grid-template-columns: 1fr !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  .results-table { font-size: 10px; }
  .table-container { max-height: none !important; overflow: visible !important; }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* Hidden utility */
.hidden { display: none !important; }

/* CCD sub-type selector */
.ccd-sub-selector {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.ccd-sub-btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.ccd-sub-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.ccd-sub-btn:hover:not(.active) {
  background: var(--bg-card-hover);
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

.app-footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
