/* =================================================================
   FORK — Green app-shell theme
   Phylogenetic-green palette, serif accents, sidebar + topbar shell
   ================================================================= */

:root {
  /* Type roles */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, 'Consolas', monospace;

  /* Shell */
  --sidebar-w: 236px;

  /* Header / nav (legacy names, kept so nothing breaks) */
  --header-bg: #ffffff;
  --header-border: #E4E5DF;
  --header-text: #64685F;
  --header-text-active: #1A1C1A;
  --nav-active-border: #1C6B54;

  /* Primary accent — phylogenetic green */
  --accent: #1C6B54;
  --accent-hover: #155744;
  --accent-light: #E7F0EB;
  --accent-dark: #0F4536;

  /* Body */
  --bg: #F6F7F4;
  --bg-card: #FFFFFF;
  --bg-section: #F1F3EE;

  /* Text */
  --text: #1A1C1A;
  --text-muted: #64685F;
  --text-light: #969A8F;

  /* Borders */
  --border: #E4E5DF;
  --border-focus: #1C6B54;
  --border-hover: #CBD3C6;

  /* Status */
  --success: #1C6B54;
  --success-bg: #E7F0EB;
  --success-border: #BED7CB;
  --error: #B31C1C;
  --error-bg: #FDF0F0;
  --error-border: #E8B0B0;
  --warning: #B9722E;
  --warning-bg: #F6ECDF;
  --warning-border: #EAD3B4;
  --info: #1558A0;
  --info-bg: #E8F0FC;
  --info-border: #A8C4F0;

  /* Inputs */
  --input-bg: #FBFCFA;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(20,40,30,.05);
  --shadow: 0 2px 8px rgba(20,40,30,.07);
  --shadow-md: 0 10px 26px -14px rgba(20,60,45,.35);

  /* Shape */
  --radius: 8px;
  --radius-sm: 5px;
}

/* ---- Reset ---- */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* =====================================================================
   SITE HEADER
   ===================================================================== */

/* ---- App shell: sidebar + main column ---- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  align-items: start;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px;
  text-decoration: none;
  color: var(--text);
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  flex-shrink: 0;
}
.brand .brand-name {
  font-family: var(--serif);
  font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  color: var(--text); line-height: 1.15;
}
.brand .brand-sub {
  font-size: 10px; color: var(--text-light); letter-spacing: .03em;
}

.side-cta {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%;
  padding: 9px 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 7px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .12s;
}
.side-cta:hover { background: var(--accent-hover); }
.side-cta svg { width: 15px; height: 15px; stroke: currentColor; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--text-light);
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 6px;
  color: var(--text-muted); font-size: 13.5px;
  text-decoration: none; cursor: pointer;
  background: none; border: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-item svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; }
.nav-item:hover { background: var(--bg-section); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }
.nav-item .nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  background: var(--warning-bg); color: var(--warning);
  padding: 0 6px; border-radius: 10px;
}

.side-foot { margin-top: auto; }
.side-db {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 12px; background: var(--bg);
}
.side-db .row { display: flex; align-items: center; gap: 8px; }
.side-db .side-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}
.side-db .t { font-size: 12.5px; font-weight: 600; color: var(--text); }
.side-db .s {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  margin-top: 6px; line-height: 1.6;
}

/* ---- FORK brand mark (minimal wave) ---- */
/* Wooden three-tine fork mark next to the FORK wordmark (#fork-logo). */
.fork-mark { width: auto; height: 1.3em; vertical-align: -0.3em; flex-shrink: 0; }
.brand .fork-mark { height: 27px; vertical-align: middle; }
.topbar-brand .fork-mark, .brand-foot .fork-mark { margin-right: 5px; }

/* ---- Interactive CGLab pixel logo above SYSTEM (links to the lab site) ---- */
.lab-logo-link {
  display: block; padding: 6px 4px 12px 8px; text-decoration: none;
}
.lab-logo-link .pixel-logo {
  width: 100%; max-width: 150px; height: auto; display: block; cursor: pointer;
}
.lab-logo-link .ll-s { display: block; margin-top: 4px; font-size: 10px; color: var(--text-light); }

/* ---- FORK wordmark at sidebar bottom (down-left) ---- */
.brand-foot {
  padding: 12px 4px 2px; color: var(--text-light);
  font-family: var(--serif); font-size: 13px; font-weight: 600;
}

/* ---- Top bar (inside main column) ---- */
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 11px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px) saturate(1.1);
}
.topbar-brand {
  font-family: var(--mono); font-size: 12px; color: var(--text-light);
  letter-spacing: .02em; white-space: nowrap;
}
.topbar .spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 11px; width: 300px; color: var(--text-light);
}
.search svg { width: 15px; height: 15px; stroke: currentColor; fill: none; flex: none; }
.search input {
  border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--text); width: 100%;
}
.search .kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-light);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
}

.db-connect-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text);
  font-size: 12.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.db-connect-btn:hover { border-color: var(--border-hover); color: var(--accent); }

.db-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #b6bcae; flex-shrink: 0; transition: background .3s;
}
.db-dot.connected { background: var(--accent); }
.db-dot.error     { background: var(--error); }
.db-dot.checking  { background: var(--warning); animation: dbpulse 1s ease-in-out infinite; }

@keyframes dbpulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---- Sidebar collapses on narrow screens ---- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row;
    flex-wrap: wrap; align-items: center; gap: 8px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar .nav-label, .sidebar .side-foot, .sidebar .side-cta { display: none; }
  .nav-group { flex-direction: row; }
  .search { width: 180px; }
}

/* =====================================================================
   DB CONFIG PANEL
   ===================================================================== */

.db-config-panel {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 190;
  display: none;
}

.db-config-panel.open { display: block; }

.db-panel-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-section);
  border-radius: 0;
}

.db-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.db-panel-header p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.db-panel-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-panel-body .form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  display: block;
  letter-spacing: .01em;
}

.db-panel-body input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12.5px;
  font-family: 'SF Mono', 'Consolas', monospace;
  outline: none;
  transition: border-color .15s;
}

.db-panel-body input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(28,107,84,.12);
}

.db-panel-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-section);
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.db-panel-footer .db-status-text {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =====================================================================
   MAIN LAYOUT
   ===================================================================== */

.site-main { flex: 1; }

.page-title-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 20px 28px 16px;
}

.page-title-bar-inner {
  max-width: 1600px;
  margin: 0;
}

.page-title-bar h1 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.page-title-bar p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.5;
}

.page-body {
  max-width: 1600px;
  margin: 0;
  padding: 24px 22px 64px;
}

/* =====================================================================
   CARDS
   ===================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-section);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.card-body { padding: 20px; }

/* =====================================================================
   ANALYSIS LAYOUT (two-column)
   ===================================================================== */

.analysis-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: start;
}

.panel-left  { display: flex; flex-direction: column; gap: 16px; }
.panel-right { display: flex; flex-direction: column; gap: 16px; }

/* =====================================================================
   FORM SECTIONS
   ===================================================================== */

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.form-section-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
  text-transform: uppercase;
  background: var(--bg-section);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.form-section-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =====================================================================
   FORM ELEMENTS
   ===================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

.form-group .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s;
  appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(28,107,84,.10);
}

.form-group textarea {
  resize: vertical;
  min-height: 72px;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M6 7L0 0h12z' fill='%235c6e80'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row.three { grid-template-columns: 1fr 1fr 1fr; }

.checkbox-group { display: flex; flex-direction: column; gap: 7px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
}

.checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}

.radio-group  { display: flex; gap: 16px; flex-wrap: wrap; }

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}

.radio-item input[type="radio"] { accent-color: var(--accent); cursor: pointer; }

.file-input {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 4px;
}

.file-input::-webkit-file-upload-button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  margin-right: 8px;
  font-family: inherit;
}

/* =====================================================================
   BUTTONS
   ===================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, border-color .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(28,107,84,.28);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--border-hover);
}

.btn-sm   { padding: 5px 11px; font-size: 12px; }

.btn-run {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
}

.btn-danger {
  background: #fff;
  color: var(--error);
  border-color: #e8c0be;
}

.btn-danger:hover:not(:disabled) { background: var(--error-bg); }

/* =====================================================================
   STATUS / PROGRESS
   ===================================================================== */

.status-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.status-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-section);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.running {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.status-dot.done  { background: var(--success); }
.status-dot.error { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.status-log {
  padding: 12px 16px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  background: #f8fafc;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* =====================================================================
   ALERTS
   ===================================================================== */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert-error   { background: var(--error-bg);   border: 1px solid var(--error-border);   color: var(--error); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-info    { background: var(--info-bg);    border: 1px solid var(--info-border);    color: var(--info); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning); }

/* =====================================================================
   TABLES
   ===================================================================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table th {
  padding: 9px 12px;
  background: var(--bg-section);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 8px 12px;
  border-bottom: 1px solid #edf0f5;
  color: var(--text);
  vertical-align: middle;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #f4f8fd; }

/* Clickable internal-node list (High-Resolution → Node path mode) */
.nodelist-table .nl-check {
  width: 1.4em;
  text-align: center;
  color: var(--accent);
  font-weight: 700;
}
.nodelist-row { cursor: pointer; }
.nodelist-row.disabled { cursor: default; color: var(--text-light); }
.nodelist-row.selected td { background: var(--accent-light); }
.nodelist-row.selected:hover td { background: var(--accent-light); }

/* =====================================================================
   IMAGES / RESULTS
   ===================================================================== */

.result-img-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-section);
}

.result-img-wrap img { width: 100%; display: block; }

.tree-iframe-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #fff;
}

.tree-iframe-wrap iframe {
  width: 100%;
  border: none;
  display: block;
  height: 900px;
}

/* =====================================================================
   DOWNLOAD BAR
   ===================================================================== */

.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-section);
  border-radius: 0 0 var(--radius) var(--radius);
}

.download-bar .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

/* =====================================================================
   TABS
   ===================================================================== */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}

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

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

/* =====================================================================
   ACCORDION / EXPANDER
   ===================================================================== */

.expander {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.expander summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
}

.expander summary::-webkit-details-marker { display: none; }
.expander summary::before {
  content: '▸';
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.expander[open] summary::before { transform: rotate(90deg); }
.expander[open] summary { border-radius: var(--radius) var(--radius) 0 0; }

.expander-body {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* =====================================================================
   HOME PAGE
   ===================================================================== */

.home-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.home-hero-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.home-hero-text h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -.01em;
}

.home-hero-text p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 700px;
}

.home-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow .2s, border-color .2s, transform .15s;
  box-shadow: var(--shadow-sm);
}

.home-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.home-card-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.home-card h2 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--text);
}

.home-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.home-secondary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.home-secondary .home-card { padding: 16px 20px; }
.home-secondary .home-card h2 { font-size: 13px; }
.home-secondary .home-card p  { font-size: 12px; }

.db-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.db-status-icon {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #bbb;
  flex-shrink: 0;
}
.db-status-icon.ok  { background: #4caf50; }
.db-status-icon.err { background: #f44336; }

/* =====================================================================
   BADGES
   ===================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-blue  { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--success-bg);   color: var(--success); }
.badge-red   { background: var(--error-bg);     color: var(--error); }
.badge-gray  { background: #eef1f5;             color: var(--text-muted); }

/* =====================================================================
   UTILITIES
   ===================================================================== */

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.font-mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 12px; }

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* =====================================================================
   SPINNER
   ===================================================================== */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* =====================================================================
   STEP INDICATOR
   ===================================================================== */

.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.step.active .step-num { background: var(--accent);  border-color: var(--accent);  color: #fff; }
.step.done   .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step.done, .step.active { color: var(--text); }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  min-width: 24px;
}

/* =====================================================================
   SLIDER
   ===================================================================== */

input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

.slider-val {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SF Mono', monospace;
  text-align: right;
  margin-top: 2px;
}

/* =====================================================================
   HIGH-RES PFAM BLOCKS
   ===================================================================== */

.pfam-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.pfam-block-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-section);
  border-radius: var(--radius) var(--radius) 0 0;
}

.pfam-block-body { padding: 14px; }

.partition-preview {
  background: #f0f6ff;
  border: 1px solid #c0d8f8;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 12px;
}

.partition-preview .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* =====================================================================
   SCROLL UTILS
   ===================================================================== */

.scroll-x { overflow-x: auto; }

/* =====================================================================
   CUSTOM FILE UPLOAD  (replaces the browser's "Browse/Περιήγηση" button)
   ===================================================================== */

.file-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.file-upload-label {
  cursor: pointer;
  flex-shrink: 0;
}

.file-name-display {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Visually hidden but still in the DOM so FormData can read .files */
.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
}

/* =====================================================================
   SITE FOOTER
   ===================================================================== */

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-inner p  { font-size: 11.5px; color: var(--text-muted); }
.footer-inner a  { color: var(--accent); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }

/* =====================================================================
   GREEN DASHBOARD  (home / overview)
   ===================================================================== */

.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px;
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm);
}
.kpi .k-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-light);
}
.kpi .k-val {
  font-family: var(--serif); font-size: 26px; font-weight: 600;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kpi .k-val small { font-family: inherit; font-size: 13px; color: var(--text-muted); }
.kpi .k-foot {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.kpi .k-foot .d { width: 7px; height: 7px; border-radius: 50%; background: var(--text-light); }
.kpi .k-foot .d.ok  { background: var(--accent); }
.kpi .k-foot .d.err { background: var(--error); }

.dash-sec { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 12px; }
.dash-sec h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--text-muted);
}
.dash-sec .rule { flex: 1; height: 1px; background: var(--border); }
.dash-sec .note { font-size: 11.5px; color: var(--text-light); font-family: var(--mono); }

.mod-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 30px; }
.mod-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.mod-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mod-card .c-top { display: flex; align-items: center; gap: 11px; }
.mod-card canvas {
  width: 44px; height: 44px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg-section); flex: none;
}
.mod-card .kicker {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--accent);
}
.mod-card h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-top: 1px; }
.mod-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.mod-card .c-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mod-card .chip {
  font-family: var(--mono); font-size: 10.5px; color: var(--accent);
  background: var(--accent-light); padding: 2px 8px; border-radius: 20px;
}
.mod-card .go { font-size: 13px; font-weight: 600; color: var(--accent); }

.runs-wrap {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.runs-scroll { overflow-x: auto; }
.runs-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.runs-table thead th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-light);
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-section); white-space: nowrap;
}
.runs-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--bg-section); font-size: 13px; vertical-align: middle; }
.runs-table tbody tr:last-child td { border-bottom: 0; }
.runs-table tbody tr:hover td { background: #FAFBF9; }
.runs-table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.runs-table .mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.runs-table .fam { font-weight: 600; }
.runs-table .fam .pf { font-family: var(--mono); color: var(--accent); font-weight: 500; }
.runs-table .t-actions { text-align: right; white-space: nowrap; }
.runs-table .t-actions a { font-size: 12.5px; margin-left: 14px; }
.runs-table .t-actions a.muted { color: var(--text-light); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.pill .ld { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok  { color: var(--accent-dark); background: var(--accent-light); }
.pill.run { color: var(--warning); background: var(--warning-bg); }
.pill.run .ld { animation: pulse 1.3s ease-in-out infinite; }

.runs-cap {
  padding: 9px 14px; font-size: 11.5px; color: var(--text-light);
  border-top: 1px solid var(--bg-section); font-family: var(--mono);
}

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .mod-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .pill.run .ld { animation: none; } }
