/* =============================================================
   MeioFlow — base.css
   Design system extracted from Claude Design output.
   All pages extend this file. Do not override variables locally;
   add a new variable here and use it everywhere instead.
   ============================================================= */

/* -------------------------------------------------------------
   FONTS
   ------------------------------------------------------------- */
.taxon-name {
  font-family: var(--font-serif);
  font-style: italic;
}

/* -------------------------------------------------------------
   DESIGN TOKENS
   ------------------------------------------------------------- */
:root {

  /* --- Color: backgrounds --- */
  --color-page-bg:        #e9edee;  /* outermost page background */
  --color-shell-bg:       #f7f8f9;  /* app card / shell background */
  --color-surface:        #ffffff;  /* panels, inputs, table rows */
  --color-surface-subtle: #fbfcfc;  /* zebra rows, tab bars, footers */
  --color-surface-muted:  #f4f5f6;  /* disabled states */

  /* --- Color: borders --- */
  --color-border:         #e4e8eb;  /* default border */
  --color-border-strong:  #dfe3e6;  /* card / shell border */
  --color-border-light:   #f1f4f5;  /* table row dividers */
  --color-border-faint:   #eceff1;  /* inner panel borders */
  --color-border-muted:   #d3d9dd;  /* stepper connectors, inactive */

  /* --- Color: text --- */
  --color-text-primary:   #1b2227;  /* headings, primary content */
  --color-text-body:      #3a454b;  /* body copy, slightly lighter than primary */
  --color-text-secondary: #5d6a72;  /* supporting text, labels */
  --color-text-muted:     #8a949b;  /* hints, placeholders, empty states */
  --color-text-faint:     #b3bbc1;  /* separators, decorative text */
  --color-text-ghost:     #c4ccd1;  /* chevrons, disabled icons */

  /* --- Color: brand (teal) --- */
  --color-brand:          #0f766e;
  --color-brand-dark:     #0b5e57;
  --color-brand-bg:       #e3f1ef;  /* active filter chip background */
  --color-brand-bg-light: #eef1f2;  /* inactive stepper, pill bg */
  --color-brand-border:   #9cc9c3;  /* active filter chip border */

  /* --- Color: status — warning (amber) --- */
  --color-warning-bg:     #fdf4e3;
  --color-warning-border: #ecc77a;
  --color-warning-accent: #d99a1c;  /* left-border, icon */
  --color-warning-text:   #7a4e0a;

  /* --- Color: status — danger / error (red) --- */
  --color-danger:         #c0392b;
  --color-danger-bg:      #fbeae8;
  --color-danger-border:  #e6a99f;
  --color-danger-text:    #8a4339;
  --color-danger-heading: #7a241b;

  /* --- Color: status — caution (same red, softer bg) --- */
  --color-caution-bg:     #fcf1ef;
  --color-caution-border: #e6b8b1;

  /* --- Color: quality scale (MI / ITD cells) --- */
  /* Background colors */
  --color-q-red-bg:       #d92d20;
  --color-q-orange-bg:    #ee7d10;
  --color-q-yellow-bg:    #efbe09;
  --color-q-green-bg:     #15a05a;
  --color-q-blue-bg:      #1f74e0;
  /* Foreground (text on those backgrounds) */
  --color-q-red-fg:       #ffffff;
  --color-q-orange-fg:    #ffffff;
  --color-q-yellow-fg:    #3a2e00;
  --color-q-green-fg:     #ffffff;
  --color-q-blue-fg:      #ffffff;

  /* --- Color: C-P distribution palette (5-step, light → dark teal) --- */
  --color-cp-1:           #d7e3df;
  --color-cp-2:           #a6c8c0;
  --color-cp-3:           #6ea89d;
  --color-cp-4:           #3f8478;
  --color-cp-5:           #1f5c52;

  /* --- Typography --- */
  --font-sans:   'IBM Plex Sans',  system-ui, sans-serif;
  --font-mono:   'IBM Plex Mono',  monospace;
  --font-serif:  'IBM Plex Serif', serif;

  /* Type scale */
  --text-2xs:    10.5px;  /* dense table headers */
  --text-xs:     11px;    /* mono labels, legend text */
  --text-sm:     12px;    /* captions, secondary */
  --text-sm-mid: 12.5px;  /* table cell secondary, hint text */
  --text-base:   13px;    /* UI text, nav, buttons */
  --text-base+:  13.5px;  /* primary buttons */
  --text-md:     14px;    /* body copy, descriptions */
  --text-lg:     15px;    /* dropzone primary label */
  --text-logo:   18px;    /* app name in header */
  --text-h1-sm:  22px;    /* h1 compact / dense layout */
  --text-h1:     25px;    /* h1 standard */

  /* --- Spacing --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  18px;
  --space-6:  22px;
  --space-7:  24px;
  --space-8:  28px;
  --space-9:  32px;
  --space-10: 40px;
  --space-14: 56px;

  /* --- Border radius --- */
  --radius-sm:   4px;   /* small badges, inline chips */
  --radius-md:   6px;   /* quality badge cells */
  --radius-base: 8px;   /* banners, buttons */
  --radius-btn:  7px;   /* small buttons */
  --radius-lg:   10px;  /* inner panels, table wrappers */
  --radius-xl:   11px;  /* composition panel */
  --radius-2xl:  12px;  /* app card, dropzone */
  --radius-pill: 20px;  /* pill badges */
  --radius-full: 9999px; /* circles, round badges */

  /* --- Shadows --- */
  --shadow-card: 0 12px 34px -22px rgba(20, 30, 40, 0.40);
  --shadow-card-lg: 0 14px 38px -22px rgba(20, 30, 40, 0.42);

  /* --- Layout --- */
  --content-max-width:         1120px; /* upload, conflicts */
  --content-max-width-wide:    1260px; /* results (wider table) */
  --content-max-width-narrow:   900px; /* upload form column */
  --page-padding-x:  40px;
  --page-padding-top: 56px;
  --page-padding-bottom: 80px;

  /* --- Stepper --- */
  --stepper-size:      22px;
  --stepper-connector: 26px; /* width of the line between steps */
}


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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text-primary);
  background: var(--color-page-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* -------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------- */
.page-wrapper {
  padding: var(--page-padding-top) var(--page-padding-x) var(--page-padding-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 56px;
  min-height: 100vh;
}

/* The outer app card that wraps each page */
.app-card {
  /*width: 100%;*/
  max-width: 1200px;
  background: var(--color-shell-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-2xl);
  overflow: clip;
  box-shadow: var(--shadow-card);
}


/* -------------------------------------------------------------
   APP HEADER
   ------------------------------------------------------------- */
.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-7);
  position: relative;
}

.app-header__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.app-header__logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--text-logo);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.app-header__mark {
  height: 1.4em;
  width: 1.4em;
}

.app-header__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-header__avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--color-brand-bg);
  color: var(--color-brand-dark);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}


/* -------------------------------------------------------------
   HEADER MENUS (Documentation dropdown, user dropdown)
   ------------------------------------------------------------- */
.header-menu {
  position: relative;
}

.header-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 4px 11px;
  border-radius: var(--radius-btn);
  background: var(--color-surface);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.header-menu__trigger::-webkit-details-marker {
  display: none;
}

.header-menu--docs .header-menu__trigger {
  border: 1.5px solid var(--color-brand-border);
}

.header-menu--user .header-menu__trigger {
  border: 1px solid var(--color-border);
}

.header-menu__chevron {
  flex: none;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.header-menu[open] .header-menu__chevron {
  transform: rotate(180deg);
}

.header-menu__divider {
  width: 1px;
  height: 22px;
  background: var(--color-border-muted);
  flex: none;
}

.header-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 6px;
  z-index: 20;
}

.header-menu__panel--docs {
  width: 300px;
}

.header-menu__panel--user {
  width: 200px;
}

.header-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-md);
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  cursor: pointer;
}

.header-menu__item:hover {
  background: var(--color-surface-subtle);
}

.header-menu__item[aria-disabled="true"] {
  cursor: default;
}

.header-menu__item[aria-disabled="true"]:hover {
  background: none;
}

.header-menu__item--button {
  align-items: center;
  font-size: var(--text-base);
  font-weight: 500;
}

.header-menu__item-icon {
  flex: none;
  margin-top: 2px;
  color: var(--color-brand);
}

.header-menu__item--button .header-menu__item-icon {
  margin-top: 0;
}

.header-menu__item-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-base+);
  font-weight: 600;
}

.header-menu__external {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.header-menu__item:hover .header-menu__external {
  color: var(--color-text-primary);
}

.header-menu__item-desc {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.header-menu__form {
  margin: 0;
  width: 100%;
}


/* -------------------------------------------------------------
   STEPPER (progress indicator: Upload → Conflicts → Results)
   ------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 9px; /* gap between circle+label pairs */
}

.stepper__step {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stepper__circle {
  width: var(--stepper-size);
  height: var(--stepper-size);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* States */
.stepper__circle--active,
.stepper__circle--done {
  background: var(--color-brand);
  color: #fff;
}

.stepper__circle--inactive {
  background: var(--color-brand-bg-light);
  color: var(--color-text-muted);
}

.stepper__label {
  font-size: var(--text-base);
}

.stepper__label--active {
  font-weight: 600;
  color: var(--color-brand-dark);
}

.stepper__label--done {
  color: var(--color-text-secondary);
}

.stepper__label--inactive {
  color: var(--color-text-muted);
}

.stepper__connector {
  width: var(--stepper-connector);
  height: 1px;
  flex: none;
}

.stepper__connector--done {
  background: var(--color-brand);
}

.stepper__connector--inactive {
  background: var(--color-border-muted);
}


/* -------------------------------------------------------------
   PAGE BODY (inside the card, below the header)
   ------------------------------------------------------------- */
.page-body {
  padding: 30px var(--space-10) 42px;
}

.page-body--narrow {
  max-width: var(--content-max-width-narrow);
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.page-head .page-title {
  margin: 0;
}

.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--text-h1);
  margin: 0 0 7px;
  letter-spacing: -0.01em;
}

.page-title--sm {
  font-size: var(--text-h1-sm);
  margin: 0;
}


/* -------------------------------------------------------------
   SECTION HEAD (shared pattern: uppercase title + count chip +
   rule. Same values as .conflict-section* in conflicts.css, which
   is left as a known duplicate for now.)
   ------------------------------------------------------------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 14px;
}

.section-head:first-of-type { margin-top: 0; }

.section-head__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
  color: var(--color-text-primary);
  white-space: nowrap;
}

.section-head__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-brand-bg-light);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.section-head__rule {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.page-subtitle {
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--color-text-secondary);
  margin: 0 0 24px;
}


/* -------------------------------------------------------------
   BANNERS
   ------------------------------------------------------------- */
/* Shared base */
.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: var(--radius-base);
  padding: 12px 14px;
  margin-bottom: 26px;
  border-width: 1px;
  border-style: solid;
  border-left-width: 4px;
}

/* Warning / amber */
.banner--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  border-left-color: var(--color-warning-accent);
}

.banner--warning .banner__text {
  color: var(--color-warning-text);
}

/* Error / blocking */
.banner--error {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  border-left-color: var(--color-danger);
  border-left-width: 5px;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  gap: 14px;
  align-items: center;
}

.banner--error .banner__heading {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--color-danger-heading);
  margin-bottom: 5px;
}

.banner--error .banner__text {
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--color-danger-text);
}

/* Success / green */
.banner--success {
  background: var(--color-brand-bg);
  border-color: var(--color-brand-border);
  border-left-color: var(--color-brand);
}

.banner__icon {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 1px;
}

.banner--warning .banner__icon {
  background: var(--color-warning-accent);
  color: #fff;
}

.banner--error .banner__icon {
  width: 26px;
  height: 26px;
  background: var(--color-danger);
  color: #fff;
}

.banner__text {
  font-size: var(--text-base);
  line-height: 1.5;
}


/* -------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base+);
  font-weight: 600;
  padding: 9px var(--space-4);
  border-radius: var(--radius-base);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn--primary {
  background: var(--color-brand);
  color: #fff;
  padding: 11px 26px;
}

.btn--primary:hover {
  background: var(--color-brand-dark);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1.5px solid var(--color-border-muted);
}

.btn--secondary:hover {
  border-color: var(--color-text-ghost);
}

.btn--danger {
  background: var(--color-danger);
  color: #fff;
  padding: 11px 26px;
}

.btn--danger:hover {
  background: #a93226;
}

.btn--danger-outline {
  background: var(--color-surface);
  color: var(--color-danger);
  border: 1.5px solid #d98980;
  padding: 9px var(--space-4);
}

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

.btn--sm {
  font-size: var(--text-base);
  padding: 8px 14px;
}


/* -------------------------------------------------------------
   COMING SOON (inert placeholder for not-yet-built UI)
   ------------------------------------------------------------- */
.coming-soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-ghost);
  background: var(--color-surface-muted);
  cursor: not-allowed;
  user-select: none;
}

.coming-soon__tag {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-ghost);
  background: var(--color-surface);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-base);
  padding: 1px 6px;
  white-space: nowrap;
}


/* -------------------------------------------------------------
   TABLES
   ------------------------------------------------------------- */

/* Standard index table */
.data-table {
  font-size: var(--text-base);
}

.data-table thead tr {
  background: var(--color-shell-bg);
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  padding: 11px 14px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border-light);
}

.data-table tbody tr:hover {
  background: #f5f8f8;
  cursor: pointer;
}

.data-table td {
  padding: 9px 14px;
}

.data-table th:first-child,
.data-table td:first-child {
  border-left: 3px solid var(--color-brand);
}

.data-table thead tr {
  background: var(--color-brand-bg);
}

.data-table thead th {
  color: var(--color-brand);
}

/* Dense variant (single-project results) */
.data-table--dense thead tr {
  background: #eef2f3;
  border-bottom: 1.5px solid #d8dee1;
}

.data-table--dense th {
  padding: 9px 14px;
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
}

.data-table--dense td {
  padding: 8px 14px;
}

/* -------------------------------------------------------------
   ACTION ROW (primary CTA + helper text)
   ------------------------------------------------------------- */
.action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.action-row--stacked {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.action-row--center {
  justify-content: center;
}

.action-row__hint {
  font-size: 12.5px;
  color: var(--color-text-muted);
}


/* Table wrapper (adds border + radius) */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}


/* -------------------------------------------------------------
   FORM FIELDS
   ------------------------------------------------------------- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.form-field:last-child {
  margin-bottom: 0;
}

.form-field__label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-field__required {
  color: var(--color-danger);
  margin-left: 3px;
}

.form-field__input,
.form-field__select {
  width: 100%;
  padding: 9px 12px;
  font-size: var(--text-md);
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-base);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.form-field__input:focus,
.form-field__select:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}

.form-field__input--error,
.form-field__select--error {
  border-color: var(--color-danger-border);
}

.form-field__select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a949b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-field__errors {
  list-style: none;
  margin: 0;
  padding: 0;
}

.form-field__errors li {
  font-size: var(--text-sm);
  color: var(--color-danger);
}

.form-field__help {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

ul.form-field__help {
  margin: 0;
  padding-left: 16px;
}

ul.form-field__help li + li {
  margin-top: 2px;
}

/* FORM PANEL — white card wrapping a group of fields */
.form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.form-panel__section + .form-panel__section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border-faint);
}

.form-panel__section-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

