/* ============================================================
   Bio-Multi-Omics WebServer ? Swiss International Style
   Surface: pure white / neutral grey. One accent: Yves Klein Blue.
   Structure: 1px hairline rules, square panels, tabular numerals.
   ============================================================ */

:root {
    --paper: #FFFFFF;
    --surface: #F7F7F8;
    --ink: #111827;
    --muted: #6B7280;
    --line: #D9DEE5;
    --line-strong: #9CA3AF;
    --accent: #002FA7;
    --accent-hover: #001E6B;
    --accent-soft: #E8ECF7;
    --ok: #1A7F4E;
    --ok-soft: #E4F3EA;
    --warn: #B7791F;
    --warn-soft: #F7EEDC;
    --bad: #C53030;
    --bad-soft: #FBE8E8;
    --mono: ui-monospace, "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
    --sans: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    --radius: 2px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    font-size: 14px;
}

/* ---------- Header ---------- */
header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
header .brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}
header .brand-mark {
    width: 14px; height: 14px;
    background: var(--accent);
    flex: 0 0 auto;
}
header h1 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--ink);
    white-space: nowrap;
}
header .subtitle {
    color: var(--muted);
    font-size: .8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
header .nav-row {
    margin-left: auto;
    display: flex;
    gap: .25rem;
    align-items: center;
}
.nav-link {
    display: inline-block;
    padding: .35rem .75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-size: .8rem;
    text-decoration: none;
    background: var(--paper);
    transition: border-color .15s, color .15s, background .15s;
}
.nav-link:hover { border-color: var(--accent); color: var(--accent); }
.nav-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }

/* Folio status strip (differentiator) */
.folio-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 1.5rem;
}
.stat-cell {
    padding: .9rem 1.25rem;
    border-right: 1px solid var(--line);
}
.stat-cell:last-child { border-right: none; }
.stat-label {
    display: block;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .25rem;
}
.stat-num {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.stat-num.accent { color: var(--accent); }

/* ---------- Panels ---------- */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card h2 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .9rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--ink);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.card h3 {
    font-size: .9rem;
    font-weight: 700;
    margin: 1rem 0 .5rem;
    color: var(--ink);
}
.card h3:first-child { margin-top: 0; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--ink);
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-size: .85rem;
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,47,167,.12);
}
.form-group { margin-bottom: .9rem; }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.form-row .form-group { margin-bottom: 0; flex: 1 1 140px; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.hint { font-size: .78rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    font-size: .82rem;
    font-weight: 600;
    font-family: var(--sans);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #14613B; border-color: #14613B; color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #9F2323; border-color: #9F2323; color: #fff; }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-sm { padding: .25rem .6rem; font-size: .75rem; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Drop zone ---------- */
.drop-zone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-align: center;
    cursor: pointer;
    background: var(--surface);
    transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.drop-zone .icon { font-size: 1.4rem; margin-bottom: .4rem; color: var(--muted); }
.drop-zone p { color: var(--muted); font-size: .85rem; }

/* ---------- File list / upload ---------- */
.file-list { margin-top: .9rem; }
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .45rem .6rem;
    border-bottom: 1px solid var(--line);
    font-size: .82rem;
}
.file-item:last-child { border-bottom: none; }
.file-item .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-family: var(--mono);
    font-size: .78rem;
}
.file-item .size { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-item .badge {
    font-size: .68rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    padding: .1rem .4rem;
    border-radius: var(--radius);
    white-space: nowrap;
}
.upload-track {
    flex: 1;
    height: 6px;
    background: var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.upload-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width .2s;
}
.upload-pct {
    font-size: .72rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.uploading { opacity: .7; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.sample-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.sample-table th, .sample-table td {
    padding: .45rem .6rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.sample-table th {
    font-weight: 600;
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--ink);
    white-space: nowrap;
}
.sample-table td { font-variant-numeric: tabular-nums; }
.sample-table tr:hover td { background: var(--surface); }

/* ---------- Status ---------- */
.status-badge {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: var(--radius);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.status-pending, .status-queued { background: var(--warn-soft); color: var(--warn); }
.status-running { background: var(--accent-soft); color: var(--accent); }
.status-completed { background: var(--ok-soft); color: var(--ok); }
.status-failed { background: var(--bad-soft); color: var(--bad); }

/* ---------- Task list ---------- */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .7rem .75rem;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background .1s;
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--surface); }
.task-item .meta { font-size: .76rem; color: var(--muted); margin-top: 2px; }

/* ---------- Log & matrices (functional mono surfaces) ---------- */
.log-box {
    background: #0F172A;
    color: #E2E8F0;
    font-family: var(--mono);
    font-size: .78rem;
    line-height: 1.5;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: .5rem;
}
.count-matrix-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .75rem;
    font-family: var(--mono);
    font-size: .74rem;
    max-height: 400px;
    overflow: auto;
    white-space: pre;
    margin-top: .5rem;
}

/* ---------- Notice / alerts ---------- */
.notice {
    margin-top: 1rem;
    padding: .7rem .9rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--ink);
    font-size: .82rem;
}
.notice-error {
    border-color: var(--bad);
    background: var(--bad-soft);
    color: #7B1D1D;
}
.notice-warn {
    border-color: var(--warn);
    background: var(--warn-soft);
    color: #7A5310;
}
.notice-success {
    border-color: var(--ok);
    background: var(--ok-soft);
    color: #14532D;
}
.notice a { color: var(--accent); font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: .7rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    font-size: .82rem;
    z-index: 9999;
    max-width: 400px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transform: translateX(120%);
    transition: transform .25s;
}
.toast-show { transform: translateX(0); }
.toast-success { border-color: var(--ok); background: var(--ok-soft); color: #14532D; }
.toast-error { border-color: var(--bad); background: var(--bad-soft); color: #7B1D1D; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.pad-2 { padding: 2rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .folio-strip { grid-template-columns: repeat(2, 1fr); }
    .stat-cell { border-right: none; border-bottom: 1px solid var(--line); }
    header { padding: .8rem 1rem; }
    header .nav-row { margin-left: 0; width: 100%; }
}


/* ---------- Beautify additions ---------- */
.hidden { display: none; }
.ellipsis { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-block { width: 100%; padding: .65rem 1rem; font-size: .95rem; }
input.input-sm { width: 110px; }
.fig-img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 auto;
}
.fig-img-lg { max-height: 640px; margin-top: 1rem; }
.login-wrap { max-width: 420px; margin: 6rem auto; padding: 0 1.5rem; }
.login-brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.25rem; }
.login-brand h1 { font-size: 1rem; font-weight: 700; margin: 0; }
#login-error { min-height: 1.2rem; margin-top: .75rem; color: var(--bad); font-size: .82rem; }
