/*
# ============================ #
#                              #
#   SSSSSSSS      K       K    #
#  S              K      K     #
#  S              K     K      #
#   SSSSSSSS      KKKKKK       #
#           S     K     K      #
#           S     K      K     #
#  SSSSSSSS       K       K    #
#                              #
# ============================ #
*/

/* Uniform vertical rhythm: tight = heading/caption -> its content,
   inner = items inside a block, block = between sibling blocks,
   legend = extra top margin of a box whose heading sits on its top border
   (half the heading height), added on top of the parent gap. */
:root {
    --gap-tight: 6px;
    --gap-inner: 12px;
    --gap-block: 24px;
    --gap-legend: 14px;
}



/* ================================
   Styles related to all html-pages
================================ */

/* Style in general */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}


/* This ensures the detail/delete controls and confirmation panel appear only when the JavaScript intentionally reveals them. */
[hidden] {
    display: none !important;
}

/* Hidden while a step is marked "Not interested"; a class, so an element's own
   hidden state (e.g. a closed Output Evaluator) is kept. */
.hidden-not-interested {
    display: none !important;
}


/* ------------------------------------- 
   Styles related to the top of the page
------------------------------------- */

/* The top title box */
.top-title-box {
    width: 100%;
    margin: 0;
    padding: 24px 20px;
    border: 2px solid #000;
    background: #fff;
    text-align: center;
}

.top-title-box h2 {
    font-size: 38px;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Adjusting the color of the top title link */
.top-title-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* Image in upper-left */
.header-img {
    position: absolute;
    top: 10px;
    left: 20px;
    height: 80px;
    max-height: 12vh;
}


/* --------------------------------------------------
   Styles related to things below the top of the page
-------------------------------------------------- */

body {
    background: #ffffff;
}

/* Light grey page background while input parameters/preferences are being edited. */
body.edit-mode,
body.edit-mode .sidebar,
body.edit-mode .top-title-box {
    background: #dcdcdc;
}


/* The "container" in which the main content of the website is displayed */
.container {
    display: flex;
    /* min-height (not height) so the container grows with long pages;
       otherwise the sticky sidebar below would scroll away after 100vh. */
    min-height: 100vh;
}



/* --------------------------------------------------
   Styles related to things below the top of the page
   - Sidebar
-------------------------------------------------- */

.sidebar {
    width: 220px;
    background: #ffffff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    /* Keep the side-panel in view while the main content scrolls. */
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: flex-start;
    flex-shrink: 0;
}

/* Keep the available-material detail page sidebar visually identical to ELK home. */
.available-material-detail-page .sidebar,
.available-material-detail-page .menu-box,
.available-material-detail-page .menu-box a,
.available-material-detail-page .sidebar-button {
    opacity: 1;
    filter: none;
    color: #000;
}

.available-material-detail-page .sidebar,
.available-material-detail-page .menu-box {
    background: #fff;
}


.sidebar::after {
    content: "";
    position: absolute;
    top: 20px;
    right: 0;
    width: 2px;
    height: calc(100% - 135px);
    background: #000;
}


.menu-box {
    border: 2px solid #000;
    padding: 15px;
    height: calc(100% - 96px);
    display: flex;
    flex-direction: column;
}

.support-row {
    margin-top: auto;
    border-top: 2px solid #000;
}

.menu-box li:not(.sidebar-placeholder):not(.bottom-placeholder):not(.logout-placeholder):hover {
    background: #efefef;
}

.logout-row {
    cursor: pointer;
}

.sidebar-placeholder,
.bottom-placeholder {
    cursor: default;
}

.menu-box li.sidebar-placeholder-final {
    border-bottom: 0;
}

.menu-box ul {
    list-style: none;
    padding: 0;
    margin: 0;

    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
}


.menu-box li {
    padding: 10px 5px;
    cursor: pointer;
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
}


.menu-box a {
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.sidebar-link-label {
    line-height: 1.2;
}

.logout-row form {
    width: 100%;
}

.sidebar-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

/* Add lines BETWEEN items */
.menu-box li:not(:last-child) {
    border-bottom: 2px solid #000;
}


/* --------------------------------------------------
   Styles related to things below the top of the page
   - Main Part of the Website
-------------------------------------------------- */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content {
    display: flex;
    flex: 1;
    width: 100%;
    line-height: 1.6;
    font-family: system-ui, sans-serif;
}

.entry-column {
    flex: 2;
    padding: 30px 24px;
    border-right: 2px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 24px;
}

.entry-column p {
    font-size: 28px;
    line-height: 1.25;
}

/* Size the table to its content so the values sit close to the labels;
   they stay aligned because they share one column. align-self stops the
   flex parent (.entry-column) from stretching it to full width. */
.available-material-metadata {
    align-self: flex-start;
    width: auto;
    border-collapse: collapse;
    margin: 0;
}

.available-material-metadata th,
.available-material-metadata td {
    margin: 0;
    padding: 0 16px 8px 0;
    font-size: 28px;
    line-height: 1.25;
    text-align: left;
    vertical-align: baseline;
}

.available-material-metadata th {
    padding-right: 32px;
    font-weight: 400;
    white-space: nowrap;
}

.available-material-metadata h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 400;
}

.available-material-metadata input[type="text"] {
    width: min(480px, 60vw);
    box-sizing: border-box;
    padding: 4px 8px;
    border: 2px solid #000;
    background: #fff;
    font-size: 22px;
}

/* Style for paragraphs */
p {
    margin-bottom: 1em;
}

/* Action buttons shared by the login and registration pages */
.main-action,
.secondary-action {
    font-size: 18px;
    /* Use one explicit line-height so <a> links styled as buttons (e.g. the
       "Download ... output archive" link) match real <button> elements.
       Otherwise links inherit line-height: 1.6 from .content while buttons
       use the browser default ("normal"), which makes links taller. */
    line-height: normal;
    padding: 10px 14px;
    border: 2px solid #000;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

.main-action:hover,
.secondary-action:hover {
    background: #efefef;
}

.inline-confirmation {
    width: 100%;
    padding: 18px;
    border: 2px solid #000;
    background: #f7f7f7;
}

.inline-confirmation p {
    margin-bottom: 14px;
    font-size: 18px;
    line-height: 1.4;
}


/* Style the clickable button inside file-upload fields */
input[type="file"]::file-selector-button {
    font-size: 18px;
    padding: 10px 14px;
    margin-right: 12px;
    border: 2px solid #000;
    background: #fff;
    color: inherit;
    cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
    background: #efefef;
}


/* ================================
   Styles related to Home_Before_Login.html
================================ */

.landing-column {
    gap: 12px;
}

.landing-column p {
    margin: 0;
}

.service-list {
    margin: 0 0 12px 0;
    padding-left: 28px;
    width: min(100%, 900px);
}

.service-list li {
    font-size: 17px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.entry-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    width: min(100%, 700px);
}

.entry-options p {
    grid-column: 1 / -1;
    margin: 0;
}

.entry-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 150px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 2px solid #000;
    padding: 24px;
    cursor: pointer;
    appearance: none;
}

.entry-option:hover {
    background: #efefef;
}

.entry-option-disabled,
.entry-option-disabled:hover {
    color: #777;
    background: #f7f7f7;
    border-color: #999;
    cursor: not-allowed;
    opacity: 1;
}


/* ============================
   Styles related to My_Profile
============================ */

.profile-panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
}

.profile-panel h2 {
    font-size: 36px;
}

/* API keys on My Profile */
.api-keys {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 22px;
    border-top: 2px solid #000;
    font-size: 18px;
}

.api-keys h3 {
    font-size: 28px;
}

.api-key-new {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 2px solid #1b7f3b;
    background: #c8efd4;
}

.api-key-new p {
    flex-basis: 100%;
}

.api-key-new code {
    padding: 6px 10px;
    border: 1px solid #000;
    background: #fff;
    overflow-wrap: anywhere;
}

.api-keys-table {
    border-collapse: collapse;
    width: 100%;
}

.api-keys-table th,
.api-keys-table td {
    padding: 8px 10px;
    border: 1px solid #000;
    text-align: left;
}

.api-key-create {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-inner);
}

.api-key-create input {
    flex: 1 1 280px;
    font-size: 18px;
    padding: 10px 12px;
    border: 2px solid #000;
}

.profile-details input:disabled {
    background: #e6e6e6;
    color: #777;
    border-color: #999;
    opacity: 1;
    cursor: not-allowed;
}


/* ================================
   Styles related to Home_Login_Menu.html
================================ */

.login-panel,
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-panel h2 {
    font-size: 36px;
}

.login-panel label {
    font-size: 22px;
}

.login-panel input {
    width: 100%;
    font-size: 20px;
    padding: 10px 12px;
    border: 2px solid #000;
    background: #fff;
}

.login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-inner);
}


/* ================================
   Styles related to Home_Register.html
================================ */

.registration-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.registration-panel h2 {
    font-size: 36px;
}

.registration-panel p {
    font-size: 20px;
    line-height: 1.4;
}

.registration-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    width: 100%;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phone-number-row {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 10px;
}

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

.registration-form label {
    font-size: 18px;
}

.registration-form input,
.registration-form select,
.registration-form textarea {
    width: 100%;
    font-size: 18px;
    padding: 10px 12px;
    border: 2px solid #000;
    background: #fff;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-inner);
}

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

.birth-date-row select {
    flex: 1;
}


/* ================================
   Styles related to Support.html
================================ */

.support-image {
    display: block;
    width: 100%;
    max-width: 760px;
    height: auto;
}


/* ================================
   Responsive styles
================================ */

@media (max-width: 800px) {
    /* Shared by all pages */
    .content {
        flex-direction: column;
    }

    /* Home_Register.html */
    .registration-form {
        grid-template-columns: 1fr;
    }

    .phone-number-row {
        grid-template-columns: minmax(170px, 1fr) minmax(0, 1.4fr);
    }
}


/* Scrollable viewer for generated ELK cell.in files */
.cell-file-viewer {
    width: 100%;
    max-height: 500px;
    overflow: auto;
    box-sizing: border-box;
    margin: 0;
    padding: 18px;
    border: 2px solid #000;
    background: #f7f7f7;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre;
}

.cif-file-section {
    width: 100%;
    margin-top: var(--gap-block);
}

.cif-file-section h3 {
    margin: 0 0 12px;
    font-size: 24px;
}

.cif-file-viewer {
    width: 100%;
    max-height: 650px;
    overflow: auto;
    box-sizing: border-box;
    margin: 0;
    padding: 18px;
    border: 2px solid #000;
    background: #f7f7f7;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre;
}


/* ========================================
   Styles related to Detailed Material View
========================================*/

/* Calculation choices shown on material-detail pages */
.workflow-step-tabs {
    display: flex;
    align-items: flex-end;
    width: 100%;
    border-bottom: 2px solid #000;
    /* Keep the step tabs in view while scrolling; opaque so content passes underneath. */
    position: sticky;
    /* Directly below the sticky material heading row (height set by the page script). */
    top: var(--material-heading-height, 0px);
    z-index: 10;
    padding-top: 10px;
    background: #fff;
}

body.edit-mode .workflow-step-tabs {
    background: #dcdcdc;
}

.workflow-step-tab {
    position: relative;
    bottom: -2px;
    box-sizing: border-box;
    display: inline-block;
    min-width: 120px;
    text-align: center;
    text-decoration: none;
    line-height: normal;
    padding: 12px 22px;
    border: 2px solid #000;
    background: #e4e4e4;
    color: inherit;
    font: inherit;
    font-size: 18px;
    cursor: pointer;
}

.workflow-step-tab + .workflow-step-tab {
    margin-left: -2px;
}

.workflow-step-tab.is-active {
    z-index: 1;
    /* Taller than the inactive tabs; the bar aligns tabs at the bottom, so it grows upward. */
    padding-top: 20px;
    border-bottom-color: #fff;
    background: #fff;
    font-weight: 700;
}

/* Declared before .is-not-interested so red wins if a step is both. */
.workflow-step-tab.has-outputs {
    border-color: #1b7f3b;
    background: #c8efd4;
    color: #0f5a28;
}

.workflow-step-tab.is-not-interested {
    border-color: #b00020;
    background: #f8caca;
    color: #8b0000;
}

/* Tab page below the step tabs. Same column layout and spacing as .entry-column,
   so wrapping the step content in it does not change the layout. */
.workflow-step-panel {
    display: flex;
    flex-direction: column;
    gap: var(--gap-block);
}

/* Once the active step has an output archive, tint the input blocks whose text
   differs from the defaults (marked by the material page script) in the tab's
   light green; the page background and unchanged blocks stay as they are. */
.workflow-step-panel.has-step-outputs:not(.is-not-interested) textarea.differs-from-default {
    border-color: #1b7f3b;
    background: #c8efd4;
}

/* Before an output archive is uploaded for the active step, the edited input
   blocks are tinted light orange instead. */
.workflow-step-panel:not(.has-step-outputs):not(.is-not-interested) textarea.differs-from-default {
    border-color: #c25e00;
    background: #ffc98a;
}

/* Blocks that must be edited before downloading (the Wannierization settings,
   or the Shared System Block when the relaxed structure is used) light up in
   red while they still hold the default text. Same red as the "not
   interested" step tabs. */
.workflow-step-panel:not(.is-not-interested) textarea.requires-modification {
    border-color: #b00020;
    background: #f8caca;
}

.input-preference-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.input-preference-panel > h3 {
    font-size: 24px;
}

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

.input-preference-choice-group {
    display: flex;
    gap: 18px;
    align-items: center;
}

.input-preference-choice-group ul {
    display: flex;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.input-preference-choice-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 18px;
    font-weight: 400;
}

.pc-execution-mode-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 18px;
}

.pc-mpi-tasks-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-mpi-tasks-control label {
    margin: 0;
    font-size: 18px;
}

.pc-mpi-tasks-control input[type="number"],
.pc-input-preference-panel > input[type="text"],
#input-preference-panel-dardel > input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 2px solid #000;
    background: #fff;
    font-size: 18px;
}

.pc-mpi-tasks-control input[type="number"] {
    width: 90px;
}

.top-input-parameter-actions {
    display: flex;
    flex-wrap: wrap;
    /* Top-align, so the other buttons don't stretch to the stacked column's height. */
    align-items: flex-start;
    gap: var(--gap-inner);
    align-self: stretch;
    /* Stays in view below the sticky heading row + step tabs, so edit mode is one click away while scrolling.
       Opaque, so content passes underneath. */
    position: sticky;
    top: calc(var(--material-heading-height, 0px) + var(--workflow-step-tabs-height, 0px));
    z-index: 9;
    padding: 10px 0;
    background: #fff;
    border-bottom: 1px solid #000;
}

body.edit-mode .top-input-parameter-actions {
    background: #dcdcdc;
}

/* Height set by the material page script in compact mode; the negative margin cancels the
   panel's flex gap, so the spacer itself adds no space. */
.sticky-header-spacer {
    height: 0;
    margin-top: calc(-1 * var(--gap-block));
    flex-shrink: 0;
}

/* Collapsing sticky header on the material page: --sticky-compact (set by the page script while
   scrolling) goes smoothly from 0 (full size) to 1 (compact); all sizes below interpolate with it.
   Only continuous properties are used (no display/layout switches), so nothing jumps. */
:root {
    --sticky-compact: 0;
}

.material-heading-row .calculation-options {
    padding: calc(8px - 8px * var(--sticky-compact)) calc(16px - 8px * var(--sticky-compact)) calc(12px - 10px * var(--sticky-compact));
}

/* "Material" / "View" legends fade and shrink away. */
.material-heading-row .calculation-options legend {
    /* Fully gone at the page script's MAX_COMPACT (0.67). */
    font-size: calc(18px * (1 - min(1, var(--sticky-compact) / 0.67)));
    opacity: calc(1 - min(1, var(--sticky-compact) / 0.67));
}

.material-heading-row .input-view-options label {
    font-size: calc(18px - 5px * var(--sticky-compact));
}

.workflow-step-tabs {
    padding-top: calc(10px - 8px * var(--sticky-compact));
}

.workflow-step-tabs .workflow-step-tab {
    min-width: calc(120px - 60px * var(--sticky-compact));
    padding: calc(12px - 10px * var(--sticky-compact)) calc(22px - 12px * var(--sticky-compact));
    font-size: calc(18px - 5px * var(--sticky-compact));
}

.workflow-step-tabs .workflow-step-tab.is-active {
    padding-top: calc(20px - 13px * var(--sticky-compact));
}

/* Second tab line ("Relaxation", ...); stays visible in compact mode, shrinking with the tab's font. */
.workflow-step-tab-subtitle {
    display: block;
}

.top-input-parameter-actions {
    padding: calc(10px - 7px * var(--sticky-compact)) 0;
}

.top-input-parameter-actions .main-action {
    padding: calc(10px - 8px * var(--sticky-compact)) calc(14px - 6px * var(--sticky-compact));
    font-size: calc(18px - 5px * var(--sticky-compact));
}

.top-input-parameter-actions .main-action {
    white-space: nowrap;
}

.step0-output-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap-inner);
    margin-top: var(--gap-block);
}

/* The convergence settings fill the left column of the first two rows;
   Basic stress and the short Fermi-energy panel stack beside them, and the
   two coordinate panels share the last row. */
.step0-output-dashboard .dashboard-control-card {
    grid-row: span 2;
}

.step0-output-block {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    white-space: pre;
    background: #f4f4f4;
    border: 1px solid #bbb;
    font: 14px/1.45 monospace;
}

.step0-variations {
    display: grid;
    gap: 8px;
    margin-top: var(--gap-inner);
}

.step0-variation {
    width: 100%;
    box-sizing: border-box;
    min-height: 52px;
    padding: 8px;
    border: 1px solid #999;
    font: 15px/1.35 monospace;
}

@media (max-width: 800px) {
    .step0-output-dashboard {
        grid-template-columns: 1fr;
    }

    .step0-output-dashboard .dashboard-control-card {
        grid-row: auto;
    }
}

.not-interested-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.material-reset-confirmation {
    margin-bottom: var(--gap-block);
}

.step-choice-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--gap-inner);
    width: 100%;
}

/* Computing Machine + Structure boxes side by side, on their own line above the Calculations box. */
.step-choice-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--gap-inner);
    flex-basis: 100%;
}

.calculation-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-inner) 24px;
    width: fit-content;
    margin: 0;
    padding: 8px 16px 12px;
    border: 2px solid #000;
    background: #f7f7f7;
}

/* Starts a new line of checkboxes (Steps 3-5: QE, EPW and GRIT calculations). */
.calculation-options-break {
    flex-basis: 100%;
    height: 0;
}

.calculation-options legend {
    padding: 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.calculation-options label,
.step1-structure-for-future-steps {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
}

/* Checkboxes and radios (Computing Machine, View) are drawn alike as squares,
   so all top blocks look the same (radios still allow only one choice). */
.calculation-options input:is([type="checkbox"], [type="radio"]),
.step1-structure-for-future-steps input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    display: inline-grid;
    place-content: center;
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 2px solid #000;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

.calculation-options input:is([type="checkbox"], [type="radio"]):checked,
.step1-structure-for-future-steps input[type="checkbox"]:checked {
    background: #000;
}

.calculation-options input:is([type="checkbox"], [type="radio"]):checked::after,
.step1-structure-for-future-steps input[type="checkbox"]:checked::after {
    content: "";
    width: 5px;
    height: 10px;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.calculation-options input:is([type="checkbox"], [type="radio"]):disabled,
.step1-structure-for-future-steps input[type="checkbox"]:disabled {
    opacity: 0.5;
}

.calculation-options input:is([type="checkbox"], [type="radio"]):focus-visible,
.step1-structure-for-future-steps input[type="checkbox"]:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

/* Step 1 "Save for future Steps" (in the shared blocks, not inside .calculation-options):
   its own line below the Shared Atomic-Positions Block; hidden without "Use relaxed structure". */
.step1-structure-for-future-steps {
    margin-top: var(--gap-inner);
}

.step1-structure-for-future-steps[hidden] {
    display: none;
}

/* Disabled calculation controls are unavailable outside edit mode. */
.calculation-options input:disabled,
.calculation-options label:has(input:disabled),
.step1-structure-for-future-steps input:disabled,
.step1-structure-for-future-steps:has(input:disabled) {
    cursor: default;
}

/* Editable ELK parameter blocks on material-detail pages */
.input-parameters-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--gap-block);
    width: 100%;
}

.input-parameters-form label {
    margin-top: var(--gap-inner);
    font-size: 20px;
    font-weight: 600;
}

.material-detail-heading {
    width: 100%;
}

.material-heading-editor {
    position: relative;
    display: grid;
    /* name | space group | crystal structure | reference */
    grid-template-columns:
        minmax(120px, 0.8fr)
        max-content
        minmax(90px, 0.45fr)
        max-content
        minmax(120px, 0.8fr)
        max-content
        minmax(160px, 1.5fr);
    align-items: center;
    gap: calc(10px - 4px * var(--sticky-compact));
    width: 100%;
    box-sizing: border-box;
}

.material-heading-editor[hidden],
#material-heading-display[hidden] {
    display: none;
}

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

.material-heading-editor input[type="text"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    /* Shrinks with the collapsing sticky header (--sticky-compact), like the rest of the heading row. */
    padding: calc(8px - 7px * var(--sticky-compact)) calc(10px - 6px * var(--sticky-compact));
    border: 2px solid #000;
    background: #fff;
    font-size: calc(18px - 5px * var(--sticky-compact));
    font-weight: 600;
}

.material-heading-separator {
    font-weight: 700;
}

.material-heading-errors {
    width: 100%;
}

.input-parameters-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    overflow-y: hidden;
}

.input-parameters-form textarea:disabled {
    background: #f7f7f7;
    color: #000;
    opacity: 1;
    cursor: default;
}

@media (max-width: 700px) {
    .material-heading-editor {
        grid-template-columns: 1fr;
    }

    .material-heading-separator {
        display: none;
    }
}

.material-parameter-section {
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    width: 100%;
}

.material-parameter-section + .material-parameter-section {
    margin-top: 0;
}

.material-parameter-section > h3 {
    margin: 0 0 4px;
    font-size: 24px;
}

/* Framed groups (Shared input Blocks of all Steps, Step 0 Calculation-specific Block Additions, qe-scf Convergence Parameters). */
.step0-shared-input-group,
.step1-shared-input-group,
.step2-shared-input-group,
.phonon-shared-input-group,
.phonon-calculation-blocks-group,
.step0-convergence-input-group > .convergence-parameters-section {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
    position: relative;
    margin-top: var(--gap-legend);
    padding-top: 24px;
}

/* Heading sits on the top border, like a fieldset legend. */
.step0-shared-input-group > h3,
.step1-shared-input-group > h3,
.step2-shared-input-group > h3,
.phonon-shared-input-group > h3,
.phonon-calculation-blocks-group > h3,
.step0-convergence-input-group > .convergence-parameters-section > h3.step0-frame-heading {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
    font-size: 24px;
}

.step1-relaxed-structure-group {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-relaxed-structure-group > h3 {
    margin-top: 0;
}

/* Recap frame (all steps): title sits in the frame border like a <legend>. */
.step1-relaxed-structure-comparison {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.material-parameter-section.step1-relaxed-structure-comparison {
    position: relative;
    margin-top: var(--gap-legend);
    padding-top: 24px;
}

/* Heading on the top border, like the other framed groups. */
.material-parameter-section.step1-relaxed-structure-comparison > h3 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

.step1-relaxed-structure-comparison > .step1-relaxed-structure-dashboard {
    margin-top: 0;
}

.step1-scf-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

/* "qe-scf" / "qe-nscf" sit on the top border of their frame, like a fieldset legend. */
.step1-scf-input-group,
.step1-nscf-input-group {
    position: relative;
    padding-top: 22px;
}

.step1-scf-input-group > h4,
.step1-nscf-input-group > .step1-calculation-group > h4 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

.step1-scf-convergence-input-group {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-scf-convergence-input-group > h3 {
    margin-top: 0;
}

.step1-bands-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-bands-input-group > h4 {
    margin: 0;
}

.step1-bands-input-group > .step1-calculation-group + .step1-calculation-group {
    margin-top: var(--gap-inner);
}

.step1-nscf-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 22px 16px 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-nscf-convergence-input-group {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-nscf-convergence-input-group > h3 {
    margin-top: 0;
}

.step1-pdos-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-pdos-input-group > .step1-calculation-group > h4 {
    margin: 0;
}

.step1-dos-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step1-dos-input-group > .step1-calculation-group > h4 {
    margin: 0;
}

.step2-relaxed-structure-group {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step2-relaxed-structure-group > h3 {
    margin-top: 0;
}

.step2-calculation-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 22px 16px 16px;
    border: 2px solid #000;
    background: #fff;
    position: relative;
}

/* Calculation names sit on the top border of their frame, like a fieldset legend. */
.step2-calculation-input-group > h4 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

/* Double class: must beat the later ".convergence-parameters-section { margin-top: 10px }". */
.convergence-parameters-section.step2-scf-convergence-input-group,
.convergence-parameters-section.step2-nscf-convergence-input-group,
.convergence-parameters-section.step2-wannier-convergence-input-group {
    box-sizing: border-box;
    padding: 24px 16px 16px;
    border: 2px solid #000;
    background: #fff;
    position: relative;
    margin-top: calc(var(--gap-inner) + var(--gap-legend));
}

/* Heading sits on the top border, like a fieldset legend. */
.convergence-parameters-section.step2-scf-convergence-input-group > h3,
.convergence-parameters-section.step2-nscf-convergence-input-group > h3,
.convergence-parameters-section.step2-wannier-convergence-input-group > h3 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

/* Steps 3-5: one frame per calculation and one per convergence-parameter box (as in Step 2). */
.phonon-calculation-group {
    display: flex;
    flex-direction: column;
}

.phonon-calculation-group + .phonon-calculation-group {
    margin-top: var(--gap-inner);
}

/* Inputs and their convergence box are separate blocks. */
.phonon-calculation-group {
    gap: var(--gap-block);
}

/* Basic view: a calculation group whose blocks and convergence box are all hidden
   takes no room (otherwise its empty box doubles the gap between its neighbours). */
body:not(.edit-mode) .input-view-basic .phonon-calculation-group:not(:has(> .phonon-calculation-input-group fieldset.calculation-block:not(.collapsible-block))):not(:has(> .convergence-parameters-section:not(.convergence-none-specified))) {
    display: none;
}

.phonon-calculation-input-group {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    padding: 22px 16px 16px;
    border: 2px solid #000;
    background: #fff;
    position: relative;
}

.phonon-calculation-input-group > h4 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

.convergence-parameters-section.phonon-convergence-input-group {
    box-sizing: border-box;
    padding: 24px 16px 16px;
    border: 2px solid #000;
    background: #fff;
    position: relative;
    margin-top: var(--gap-legend);
}

.convergence-parameters-section.phonon-convergence-input-group > h3 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

.calculation-block-comment {
    margin: 0;
    font-size: 14px !important;
    line-height: 1.35;
}

.step0-calculation-input-group {
    box-sizing: border-box;
    padding: 16px;
    border: 2px solid #000;
    background: #fff;
}

.step0-calculation-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    position: relative;
    padding-top: 22px;
}

.step0-calculation-input-group + .step0-calculation-input-group {
    margin-top: var(--gap-inner);
}

/* Keep the first label clear of the outer frame's heading. */
.step0-shared-input-group > h3 + .step0-calculation-input-group,
.step0-shared-input-group > h3 + .step1-scf-input-group,
.step0-shared-input-group > h3 + .step2-calculation-input-group {
    margin-top: var(--gap-inner);
}

/* "qe-scf" / "qe-vc-relax" sit on the top border, like a fieldset legend. */
.step0-calculation-input-group > h4 {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 8px;
    background: #fff;
    line-height: 1.2;
}

.step0-convergence-input-group {
    margin-top: var(--gap-block);
}

.parameter-text-field {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 2px solid #000;
    background: #fff;
}

.parameter-text-field:has(textarea:disabled) {
    background: #f7f7f7;
}

.parameter-text-field legend {
    margin-left: 12px;
    padding: 0 8px;
}

.input-parameters-form .parameter-text-field legend label {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.input-parameters-form .parameter-text-field > legend {
    font-size: 20px;
    font-weight: 600;
}

.input-parameters-form .parameter-text-field textarea {
    display: block;
    margin: 0;
    border: 0;
    overflow-y: hidden;
    resize: none;
}

/* Make the coordinate names part of the textbox frame instead of placing
   them above the frame as separate headings. */
.step1-relaxed-structure-dashboard .relaxed-coordinate-field {
    min-width: 0;
    padding: 0;
    background: #f7f7f7;
}

.step1-relaxed-structure-dashboard .relaxed-coordinate-field legend {
    font-size: 20px;
    font-weight: 600;
}

.step1-relaxed-structure-dashboard .relaxed-coordinate-field textarea {
    min-height: 250px;
    background: transparent;
}

.step1-expression-calculator {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 2px solid #000;
    background: #f7f7f7;
}

.step1-expression-calculator > label {
    display: block;
    margin-bottom: var(--gap-tight);
    font-size: 18px;
    font-weight: 600;
}

.step1-expression-calculator-row {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    align-items: stretch;
    gap: var(--gap-inner);
}

.step1-expression-calculator input {
    min-width: 0;
    box-sizing: border-box;
    height: 44px;
    padding: 8px 10px;
    border: 2px solid #000;
    background: #fff;
    font: 16px/1.3 monospace;
}

.step1-expression-calculator output {
    display: block;
    min-width: 0;
    box-sizing: border-box;
    height: 44px;
    padding: 8px 10px;
    border: 2px solid #000;
    background: #fff;
    font: 16px/1.3 monospace;
}

.step1-expression-calculator output:empty::before {
    content: attr(data-placeholder);
    color: #777;
}

.step1-expression-calculator output.is-error {
    color: #a00000;
}

.step1-expression-calculator p {
    margin: var(--gap-tight) 0 0;
    color: #444;
    font-size: 14px;
}

@media (max-width: 600px) {
    .step1-expression-calculator-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .step1-expression-calculator output {
        min-width: 0;
    }
}

.parameter-text-field .errorlist {
    margin: 0;
    padding: 8px 16px;
}

.calculation-block {
    width: 100%;
}

.calculation-block h3 {
    margin: 0 0 var(--gap-inner);
    font-size: 24px;
}

.calculation-block pre {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 16px;
    border: 2px solid #000;
    background: #f7f7f7;
    font-family: monospace;
    font-size: 15px;
    line-height: 1.5;
}

.qe-structure-block {
    width: 100%;
}

.grit-material-detail-page .qe-structure-block {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 2px solid #000;
    background: #f7f7f7;
}

.grit-material-detail-page .qe-structure-block legend {
    margin-left: 12px;
    padding: 0 8px;
    font-size: 20px;
    font-weight: 600;
}

.grit-material-detail-page .qe-structure-block pre {
    margin: 0;
    border: 0;
    background: transparent;
}

.qe-structure-block > h4 {
    margin: 0 0 var(--gap-tight);
    font-size: 20px;
    font-weight: 600;
}

.wannier-centres-card {
}

.wannier-bands-card {
}

.wannier-bands-frame {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
    margin: 0 0 var(--gap-inner);
    border: 1px solid #000;
    background: #fff;
}

.wannier-tools-bands-card {
    grid-column: span 2;
}

.smooth-plot-image-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid #000;
    background: #fff;
}

.smooth-plot-image-layer {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.image-plot-viewport {
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}

.image-plot-zoom-selection {
    position: absolute;
    z-index: 4;
    border: 2px dashed #1565c0;
    background: rgba(21, 101, 192, 0.18);
    pointer-events: none;
}

.wannier-tools-bands-image {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    background: #fff;
    opacity: 1;
    transform: scale(1);
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        filter 180ms ease;
    will-change: opacity, transform;
}

.wannier-tools-bands-image.plot-image-outgoing {
    position: absolute;
    inset: 0;
    z-index: 2;
    opacity: 1;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.wannier-tools-bands-image.plot-image-outgoing.is-leaving {
    opacity: 0;
}

.wannier-tools-bands-card.is-loading
    .wannier-tools-bands-image:not(.plot-image-outgoing) {
    opacity: 0.72;
    filter: saturate(0.8);
}

.wannier-tools-bands-image.is-switching {
    opacity: 0;
    transform: scale(0.995);
}

.wannier-centres-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

.wannier-centres-table th,
.wannier-centres-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #ccc;
    text-align: right;
}

.wannier-centres-table th:first-child,
.wannier-centres-table td:first-child {
    text-align: left;
}


/* Reserve enough lower-page space for the evaluator's button row and upload form.
   Opening the evaluator will use this space instead of lengthening the page again. */
.output-evaluator-region {
    width: 100%;
    min-height: 320px;
    box-sizing: border-box;
}


.output-evaluation {
    width: 100%;
    box-sizing: border-box;
    padding: 18px;
    border: 2px solid #000;
}

.step-one-actions {
    display: flex;
    align-items: stretch;
    gap: var(--gap-inner);
    width: 100%;
}

.step-one-actions .main-action {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.output-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-inner);
}

.output-upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-inner);
}

.output-remove-form {
    margin: 0;
}

.output-upload-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap-inner);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.scrape-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    /* Keep existing dashboard plots from looking like live evaluation
       updates underneath an upload/evaluation overlay. */
    background: #fff;
}

.scrape-loading-box {
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(100%, 520px);
    padding: 18px 20px;
    border: 2px solid #000;
    background: #fff;
    box-shadow: 6px 6px 0 #000;
}

.scrape-loading-copy {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: var(--gap-inner);
}

.scrape-loading-box p {
    font-size: 20px;
    line-height: 1.25;
}

.scrape-loading-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scrape-loading-progress-track {
    width: 100%;
    height: 18px;
    border: 2px solid #000;
    background: #fff;
}

.scrape-loading-progress-fill {
    width: 0;
    height: 100%;
    background: #000;
    transition: width 0.2s ease;
}

.scrape-loading-progress-fill.is-stalled {
    background: repeating-linear-gradient(
        -45deg,
        #000 0,
        #000 10px,
        #666 10px,
        #666 20px
    );
    background-size: 28px 28px;
    animation: scrape-loading-progress-slide 0.8s linear infinite;
}

@keyframes scrape-loading-progress-slide {
    to {
        background-position: 28px 0;
    }
}

.scrape-loading-progress p {
    font-size: 16px;
}

.scrape-loading-estimate {
    margin-top: -2px;
    color: #444;
    font-size: 15px !important;
}

.scrape-loading-spinner {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: 4px solid #d8d8d8;
    border-top-color: #000;
    border-radius: 50%;
    animation: scrape-loading-spin 0.8s linear infinite;
}

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

.hidden {
    display: none;
}

/* Output hints and upload messages match the 18px upload buttons next to them.
   Scoped to .entry-column so it outranks the 28px ".entry-column p" rule
   meant for the large welcome text. */
.entry-column .output-message {
    font-size: 18px;
    line-height: 1.4;
}

/* Hints below the upload buttons (e.g. "Upload the Step1_output.zip ...")
   get some breathing room from the buttons above them. */
.output-upload-row ~ .output-message {
    margin-top: var(--gap-inner);
}

.output-message.error {
    color: #9c1c1c;
}

.output-message.success {
    color: #176b2c;
}

/* Small info window at the top of the page (e.g. values the user still has to
   fill in before downloading). Closed with its × button. */
.info-window {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    gap: var(--gap-inner);
    width: min(640px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 14px 16px;
    /* Same look as the rest of the site: white with a 2px black border. */
    background: #fff;
    border: 2px solid #000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.info-window-icon {
    flex: none;
    box-sizing: border-box;
    width: 26px;
    height: 26px;
    border: 2px solid #000;
    border-radius: 50%;
    color: #000;
    font: bold 16px/22px Georgia, serif;
    text-align: center;
}

.info-window-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Yes / No of "Want to download anyways?" */
.info-window-actions {
    display: flex;
    gap: 10px;
}

.entry-column .info-window-text {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    color: #000;
}

.info-window-close {
    flex: none;
    padding: 0 4px;
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    color: #000;
    cursor: pointer;
}

.info-window-close:hover {
    background: #efefef;
}

.fermi-value {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    border: 2px solid #000;
}

.dashboard-control-card .fermi-value {
    min-height: 120px;
    padding: 0;
    border: 0;
}

/* Inside the convergence card the Fermi energy is a compact section. */
.dashboard-control-card .dashboard-fermi-group .fermi-value {
    min-height: 0;
}

.dashboard-control-card #convergence-result-sliders {
    min-height: 120px;
    justify-content: center;
}

.fermi-value strong {
    font-family: monospace;
    font-size: 28px;
}

#convergence-result-sliders,
#step0-convergence-result-sliders,
#wannier-convergence-result-sliders,
#wt-convergence-result-sliders {
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
}

.convergence-result-slider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr);
    align-items: center;
    gap: var(--gap-inner);
}

.convergence-slider-track {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.convergence-slider-track input {
    width: 100%;
}

.convergence-slider-end {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #000;
    border-radius: 2px;
    background: #fff;
    color: #000;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.convergence-slider-end:hover {
    background: #000;
    color: #fff;
}

.convergence-result-slider output {
    font-family: monospace;
    white-space: pre-wrap;
    text-align: left;
}

.electronic-structure-evaluation {
    width: 100%;
    margin-top: var(--gap-block);
}

/* Match the ELK evaluator spacing between the upload controls and the
   results dashboard. */
.step1-output-dashboard {
    width: 100%;
    margin-top: var(--gap-block);
}

.electronic-structure-evaluation h3 {
    margin: 0 0 var(--gap-inner);
    font-size: 24px;
}

.electronic-structure-status {
    margin: 0 0 var(--gap-inner);
    font-size: 16px;
}

.electronic-structure-status:empty {
    display: none;
}

.step1-output-dashboard > .electronic-structure-status {
    grid-column: 1 / -1;
}

.electronic-structure-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: var(--gap-inner);
    width: 100%;
}

/* Step 2 uses the shared .electronic-structure-dashboard grid, like Step 1;
   only the spacing above it and the overlay dropdown need their own rules. */
.step2-output-dashboard {
    margin-top: var(--gap-block);
}

.step2-output-dashboard select {
    width: 100%;
    font-size: 16px;
}

/* Short notes in the Step 2 cards ("Total spread", missing results). The
   prefix outranks the 28px ".entry-column p" welcome-text rule. */
/* Error message of a failed Step 2 folder, shown above the Wannier90 bands. */
.step2-calculation-error {
    margin: 0 0 var(--gap-inner);
    padding: 12px 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    border: 2px solid #b00020;
    background: #fdecea;
    color: #8b0000;
    font: 14px/1.45 monospace;
}

.entry-column .step2-output-dashboard .plot-card-message {
    margin: var(--gap-tight) 0 0;
    font-size: 16px;
}

/* Steps 3-5: the note on the <will_be_copied_from_...> placeholders. */
.entry-column .phonon-placeholder-note {
    margin: 0 0 var(--gap-inner);
    font-size: 16px;
}

/* Step 5: the counter-terms table scrolls inside its card. */
.phonon-gkk-table-scroll {
    max-height: 640px;
    overflow-y: auto;
}

.phonon-gkk-table tbody tr:hover td {
    background: #eef3fb;
}

.phonon-gkk-table tr.is-unfinished td {
    background: #fff3e0;
}

/* The per-coupling plot boxes are cards of the dashboard grid itself. */
.phonon-gkk-plots {
    display: contents;
}

.phonon-gkk-overview {
    grid-column: 1 / -1;
}

.phonon-gkk-window {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--gap-tight);
    font-size: 14px;
}

.phonon-gkk-window input {
    width: 6em;
}

/* The summary and the definition of the plotted |g| (degenerate average): text as small as the label above. */
.entry-column .step2-output-dashboard .phonon-gkk-overview p {
    margin: 0 0 var(--gap-tight);
    font-size: 14px;
}

/* Wide formulas scroll instead of overflowing the card on narrow screens. */
.phonon-gkk-formula {
    overflow-x: auto;
    font-size: 14px;
}

/* A KaTeX axis label inside a plot (foreignObject of height 34, centred). */
.plot-axis-label-tex {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 12px;
    white-space: nowrap;
}

/* The global * rule (Arial, border-box) would replace KaTeX's math fonts and break its spacing. */
.katex * {
    font-family: inherit;
    box-sizing: content-box;
}

.phonon-gkk-card.is-energy-mismatch {
    background: #fff3e0;
}

/* Legend inside each coupling plot (top right of the plot area): QE open
   circles, EPW filled dots. The light background keeps points behind it visible. */
.phonon-gkk-legend {
    position: absolute;
    z-index: 2;
    top: 7%;
    right: 6%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 7px;
    border: 1px solid #aaa;
    background: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    pointer-events: none;
}

.phonon-gkk-legend span::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    vertical-align: middle;
    border: 1.5px solid var(--plot-colour);
    border-radius: 50%;
    background: var(--plot-colour);
}

.phonon-gkk-legend span.is-hollow::before {
    background: transparent;
}

/* Negative order keeps the convergence sliders in the first grid cell, ahead
   of the magnetic-moment cards, which have the default order of 0. */
.workflow-step-2 #elk-convergence-control-card {
    order: -1;
}

.workflow-step-2 #bands-plot-card {
    grid-column: span 2;
    order: 2;
}

.workflow-step-2 .wannier-centres-card {
    order: 3;
}

.workflow-step-3 .wannier-tools-bands-card {
    grid-column: auto;
    order: 2;
}

.workflow-step-3.electronic-structure-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workflow-step-3 #elk-convergence-control-card {
    grid-column: auto;
    order: 1;
}

.workflow-step-3 .smooth-plot-image-frame {
    height: clamp(260px, 28vw, 420px);
}

.workflow-step-3 .wannier-tools-bands-image {
    height: 100%;
    object-fit: contain;
}

.plot-card {
    position: relative;
    min-width: 0;
    padding: 10px;
    border: 2px solid #000;
    background: #f7f7f7;
}

/* Text inside a card: inner spacing instead of the browser's 1em paragraph margin. */
.plot-card p {
    margin: 0 0 var(--gap-inner);
}

.plot-card p:last-child {
    margin-bottom: 0;
}

.plot-card:fullscreen,
.plot-card:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    box-sizing: border-box;
    padding: 20px;
    overflow: hidden;
    border: 0;
    background: #f7f7f7;
}

.plot-card:fullscreen .plot-viewport,
.plot-card:-webkit-full-screen .plot-viewport {
    display: flex;
    flex: 1;
    min-height: 0;
}

.plot-card:fullscreen .electronic-structure-plot,
.plot-card:-webkit-full-screen .electronic-structure-plot {
    width: 100%;
    height: 100%;
    flex: 1;
    aspect-ratio: auto;
}

.plot-card:fullscreen .plot-zoom-controls,
.plot-card:-webkit-full-screen .plot-zoom-controls {
    flex: 0 0 auto;
}

/* Keep the species-specific PDOS cards inside their full-width section, but
   give each plot one normal dashboard column instead of letting one plot
   expand across the entire evaluator grid. */
.pdos-plots-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap-inner);
}

/* The wrapper creates no box of its own, so each species-specific magnetic
   moment card becomes a separate cell of the evaluator grid. */
.moments-plots-container {
    display: contents;
}

.pdos-dashboard-card {
    grid-column: auto;
}

.plot-card-wide {
    grid-column: 1 / -1;
}

.step1-output-log-card {
    grid-column: 1 / -1;
}

.step1-fermi-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap-inner);
}

.step1-fermi-summary h5 {
    margin: 0 0 var(--gap-tight);
    font-size: 16px;
}

.step1-output-log {
    max-height: 520px;
    margin: 0;
    padding: 14px;
    overflow: auto;
    white-space: pre;
    background: #f4f4f4;
    border: 1px solid #bbb;
    font: 13px/1.45 monospace;
}

.plot-card h4 {
    margin: 0 0 var(--gap-tight);
    font-size: 20px;
}

.dashboard-convergence-group + .dashboard-convergence-group,
#phonon-convergence-result-sliders + .dashboard-convergence-group {
    margin-top: var(--gap-block);
    padding-top: 14px;
    border-top: 1px solid #aaa;
}

.dashboard-convergence-group h5 {
    margin: 0 0 var(--gap-tight);
    font-size: 16px;
}

.plot-card-message {
    margin: 0 0 var(--gap-tight);
    font-size: 14px;
}

.plot-card-message:empty {
    display: none;
}

.plot-viewport {
    position: relative;
}

.electronic-structure-plot {
    display: block;
    width: 100%;
    min-height: 0;
    aspect-ratio: 900 / 480;
    border: 1px solid #000;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.plot-zoom-selection {
    fill: rgba(21, 101, 192, 0.18);
    stroke: #1565c0;
    stroke-width: 2;
    stroke-dasharray: 6 4;
    pointer-events: none;
}

.plot-zoom-controls {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: var(--gap-tight);
}

.plot-zoom-controls button {
    min-width: 36px;
    padding: 5px 9px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font: inherit;
    cursor: pointer;
}

.plot-zoom-controls button:hover {
    background: #000;
    color: #fff;
}

.plot-visibility-controls {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: var(--gap-tight);
}

.plot-visibility-controls button {
    padding: 5px 9px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font: inherit;
    cursor: pointer;
}

.plot-visibility-controls button:hover {
    background: #000;
    color: #fff;
}

.electronic-structure-legend {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: calc(100% - 120px);
    max-height: 190px;
    box-sizing: border-box;
    margin: 0;
    padding: 7px 9px;
    overflow: auto;
    border: 1px solid #aaa;
    background: rgba(255, 255, 255, 0.9);
    font-size: 13px;
}

.electronic-structure-legend--large {
    font-size: 18px;
}

.electronic-structure-legend[data-position="top-left"] {
    top: 6%;
    right: auto;
    bottom: auto;
    left: 9%;
}

.electronic-structure-legend[data-position="top-right"] {
    top: 6%;
    right: 3%;
    bottom: auto;
    left: auto;
}

/* Vertically centred in the plot area (6% from the top, 18% from the bottom). */
.electronic-structure-legend[data-position="center-right"] {
    top: 44%;
    right: 3%;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
}

.electronic-structure-legend[data-position="bottom-left"] {
    top: auto;
    right: auto;
    bottom: 18%;
    left: 9%;
}

.electronic-structure-legend[data-position="bottom-right"] {
    top: auto;
    right: 3%;
    bottom: 18%;
    left: auto;
}

.electronic-structure-legend:empty {
    display: none;
}

.electronic-structure-legend span::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 3px;
    margin-right: 6px;
    vertical-align: middle;
    background: var(--plot-colour);
}

/* The dashed E_F line (red, 7px dash, 5px gap as in the plot). */
.electronic-structure-legend span.is-dashed::before {
    background: repeating-linear-gradient(90deg, var(--plot-colour) 0 7px, transparent 7px 12px);
}

@media (max-width: 720px) {
    .step-one-actions {
        flex-direction: column;
    }

    .convergence-result-slider {
        grid-template-columns: 1fr;
    }

    .electronic-structure-dashboard {
        grid-template-columns: 1fr;
    }

    .pdos-plots-container {
        grid-template-columns: 1fr;
    }

    .step1-fermi-summary {
        grid-template-columns: 1fr;
    }

    .workflow-step-2 #bands-plot-card {
        grid-column: auto;
    }

    .workflow-step-3.electronic-structure-dashboard {
        grid-template-columns: 1fr;
    }

    .workflow-step-3 #elk-convergence-control-card {
        grid-column: auto;
    }

    .wannier-tools-bands-card {
        grid-column: auto;
    }

}


/* ===========================================
    Styles related to the "My Materials" page
=========================================== */

/* Selectable material cards, based on the My Applications layout */
#materials-selection-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding-bottom: 96px;
}

.materials-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Keep the selection actions visually separated from the last material card. */
#available-material-actions {
    margin-top: var(--gap-block);
}

.material-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    align-items: stretch;
    gap: 18px;
    width: 100%;
    box-sizing: border-box;
    padding: 18px;
    border: 2px solid #000;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.material-card[draggable="true"] {
    cursor: grab;
}

.material-card.is-dragging {
    opacity: 0.45;
}

.material-card.is-drag-over {
    border-color: #555;
    box-shadow: inset 0 -5px 0 #555;
}

.material-card:hover,
.material-card.is-selected {
    background: #efefef;
}

.material-card.is-selected {
    box-shadow: inset 6px 0 0 #000;
}

.material-card-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.material-calculation-details {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) auto minmax(0, 1fr) auto minmax(0, 2fr);
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
}

/* One shared grid for all cards (via subgrid), so the columns line up across
   rows: every column is as wide as its longest entry (the name at most half),
   and the remaining width is spread evenly between the columns. */
.materials-list.has-step-progress {
    display: grid;
    grid-template-columns: fit-content(50%) repeat(8, auto) 72px;
    justify-content: space-between;
    gap: 16px 10px;
}

.materials-list.has-step-progress .material-card {
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    gap: inherit;
}

.materials-list.has-step-progress .material-calculation-details {
    grid-column: 1 / -2;
    grid-template-columns: subgrid;
    gap: inherit;
}

.material-step-progress {
    display: flex;
    gap: 8px;
}

.material-step-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    border: 2px solid #000;
    background: #fff;
    font-size: 18px;
}

.material-step-box.has-outputs {
    border-color: #1b7f3b;
    background: #c8efd4;
    color: #0f5a28;
}

.material-step-box.not-interested {
    border-color: #b00020;
    background: #f8caca;
    color: #8b0000;
}

.material-calculation-details h3,
.material-calculation-details p {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-card-details h3,
.material-card-details p {
    margin: 0;
}

.material-card-details h3 {
    font-size: 24px;
}

.material-calculation-details p {
    font-size: 18px;
    line-height: 1.35;
}

.material-card-details p {
    font-size: 18px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.material-card-separator {
    font-size: 18px;
}

.material-selection-checkbox {
    align-self: center;
    justify-self: center;
    width: 28px;
    height: 28px;
    margin: 0;
    cursor: pointer;
    accent-color: #000;
}

#delete-materials-confirmation {
    padding: 18px;
    border: 2px solid #000;
    background: #f7f7f7;
}

#delete-materials-confirmation p {
    font-size: 18px;
}

/* Material-calculation creation form */
.material-create-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    width: 100%;
}

.material-create-form p {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
    font-size: 18px;
}

.material-create-form label {
    font-size: 18px;
    font-weight: 600;
}

.material-create-form input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 2px solid #000;
    background: #fff;
    font-size: 18px;
}

.material-create-form input[type="file"] {
    max-width: 100%;
    font-size: 16px;
}

/* CIF drag-and-drop zone */
#cif-upload-fields,
#shared-cif-fields {
    width: 100%;
}

.material-create-form .cif-drop-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 140px;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 24px;
    border: 2px dashed #000;
    background: #fff;
    text-align: center;
    font-weight: 400;
    cursor: pointer;
}

.material-create-form .cif-drop-zone:hover,
.material-create-form .cif-drop-zone.is-drag-over {
    background: #efefef;
    border-style: solid;
}

.material-create-form .cif-drop-zone:focus-within {
    outline: 2px solid #555;
    outline-offset: 2px;
}

.cif-drop-zone-filename {
    font-weight: 600;
}

/* Keep the real file input in the form (and keyboard-focusable) but hide it visually. */
.material-create-form .cif-drop-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.structure-source-options {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
}

.structure-source-options legend {
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

#id_structure_source {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--gap-inner);
    width: 100%;
}

#id_structure_source > div {
    display: flex;
}

#id_structure_source label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 72px;
    box-sizing: border-box;
    padding: 14px;
    border: 2px solid #000;
    background: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
}

#id_structure_source label:hover {
    background: #efefef;
}

#id_structure_source label:has(input:checked) {
    background: #efefef;
    box-shadow: inset 6px 0 0 #000;
}

#id_structure_source input[type="radio"] {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #000;
    cursor: pointer;
}

@media (max-width: 720px) {
    #id_structure_source {
        grid-template-columns: 1fr;
    }
}


#catalogue-material-fields {
    width: 100%;
}

#manual-structure-fields,
#shared-cif-fields,
#shared-manual-fields {
    width: 100%;
}

#manual-structure-fields,
#shared-manual-fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.material-create-form .parameter-text-field textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    border: 0;
    font: 16px/1.4 monospace;
    resize: vertical;
}

.shared-material-editor {
    width: 100%;
    box-sizing: border-box;
}

.shared-material-editor[open] {
    padding: 18px;
    border: 2px solid #000;
    background: #f7f7f7;
}

.shared-material-editor summary {
    font-size: 20px;
    font-weight: 400;
    cursor: pointer;
    width: fit-content;
    list-style: none;
}

.shared-material-editor summary::-webkit-details-marker {
    display: none;
}

/* The "Add a shared material" button disappears once the panel is open. */
.shared-material-editor[open] summary {
    display: none;
}

/* Hide the catalogue list while the "Add a shared material" panel is open. */
.shared-material-editor[open] ~ #available-material-selection-form {
    display: none;
}

.form-success {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    border: 2px solid #000;
    background: #f1f7ee;
    font-size: 18px !important;
}

#catalogue-material-fields p {
    width: 100%;
}

#id_catalogue_material {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 44px 12px 14px;
    border: 2px solid #000;
    border-radius: 0;
    background-color: #fff;
    color: inherit;
    font: inherit;
    font-size: 18px;
    cursor: pointer;
}

#id_catalogue_material:hover {
    background-color: #efefef;
}

#id_catalogue_material:focus {
    outline: 3px solid #777;
    outline-offset: 2px;
}


/* =============================================
Variable ELK convergence-parameter fields Begin
============================================= */

.convergence-parameters-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--gap-inner);
    width: 100%;
    /* Sits in 12px-gap sections: 12 + 12 = one block gap. */
    margin-top: var(--gap-inner);
}

.convergence-parameters-section h3 {
    margin: 0;
    font-size: 20px;
}

.wt-convergence-slot-title {
    margin: 0 0 var(--gap-tight);
    font-size: 16px;
}

.convergence-fields {
    display: flex;
    flex-direction: column;
    gap: var(--gap-inner);
    width: 100%;
}

.convergence-parameter-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--gap-inner);
    width: 100%;
}

.convergence-workspace {
    min-width: 0;
    width: 100%;
}

.convergence-tab-navigation {
    display: flex;
    align-items: end;
    gap: 6px;
    width: 100%;
}

.convergence-tabs {
    display: flex;
    flex: 0 1 auto;
    align-items: flex-end;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: calc(100% - 96px);
    padding: 0 4px;
}

.convergence-tab-arrow {
    position: relative;
    bottom: -2px;
    min-width: 42px;
    height: 38px;
    padding: 8px 10px;
    border: 2px solid #000;
    background: #fff;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.convergence-tab-arrow:hover:not(:disabled) {
    background: #efefef;
}

.convergence-tab-arrow:disabled {
    color: #999;
    cursor: default;
}

.convergence-tabs::-webkit-scrollbar {
    display: none;
}

.convergence-tab {
    position: relative;
    bottom: -2px;
    flex: 0 0 auto;
    height: 38px;
    padding: 8px 14px;
    border: 2px solid #000;
    background: #e4e4e4;
    color: inherit;
    font-size: 15px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.convergence-tab.is-active {
    z-index: 1;
    border-bottom-color: #fff;
    background: #fff;
    font-weight: 700;
}

.convergence-editors {
    border: 2px solid #000;
    background: #fff;
}

.convergence-editors:has(textarea:disabled) {
    background: #f7f7f7;
}

.convergence-editor textarea,
.input-parameters-form .convergence-editor textarea {
    display: block;
    width: 100%;
    min-height: 130px;
    margin: 0;
    border: 0;
    outline: 0;
}

.convergence-editor textarea:focus {
    box-shadow: inset 0 0 0 2px #777;
}

.variation-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 38px;
}

/* All +/- buttons for convergence parameters and their settings share one
   fixed square size, so "+" and "-" (and both button groups) look identical. */
.variation-controls .secondary-action,
.convergence-parameter-controls .secondary-action {
    width: 46px;
    height: 46px;
    padding: 0;
    font-size: 24px;
    line-height: 1;
}

/* WT fields have an extra slot title above their tabs. Keep their setting
   controls aligned with the editor, just like the ELK/Wannier fields. */
#wt-convergence-parameter-fields .variation-controls {
    padding-top: 72px;
}

.convergence-delete-field {
    display: none;
}

.convergence-parameter-controls {
    display: flex;
    gap: var(--gap-inner);
}

/* =============================================
Variable ELK convergence-parameter fields End
============================================= */

/* Shared CONTROL / ELECTRONS blocks start collapsed (material_detail.html). */
.calculation-block.is-collapsed textarea {
    display: none;
}

.collapsed-block-toggle {
    margin-left: 0.75rem;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    opacity: 0.6;
    font: inherit;
    font-size: 0.85em;
    font-weight: normal;
    font-style: italic;
    cursor: pointer;
}

.collapsed-block-toggle:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Step 0/2 "converged calculation" button: gap to the convergence sliders above. */
#step0-save-converged-button,
#step2-save-converged-button {
    margin-top: var(--gap-inner);
}

/* Step 0 "converged calculation" button: small square box, crossed when saved. */
.converged-checkbox {
    display: inline-block;
    position: relative;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.5em;
    vertical-align: -0.1em;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}
.converged-checkbox.is-crossed::before,
.converged-checkbox.is-crossed::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 120%;
    height: 1.5px;
    background: currentColor;
}
.converged-checkbox.is-crossed::before { transform: translate(-50%, -50%) rotate(45deg); }
.converged-checkbox.is-crossed::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* Small "i" icon that shows an info box on hover/focus. */
.hover-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    border: 1.5px solid #000;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    cursor: help;
    vertical-align: middle;
}

.hover-info-box {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    width: max-content;
    max-width: 320px;
    padding: 8px 10px;
    border: 2px solid #000;
    background: #fff;
    font-size: 14px;
    font-weight: 400;
    font-style: normal;
    line-height: 1.35;
}

.hover-info:hover .hover-info-box,
.hover-info:focus .hover-info-box {
    display: block;
}

/* View = basic: blocks that are collapsed by default are hidden entirely. */
.input-view-basic fieldset.collapsible-block {
    display: none;
}

/* Heading row: material description with the View switch right next to it. */
.material-heading-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    /* Stays at the top while scrolling, with the step tabs right below it; opaque so content passes underneath. */
    position: sticky;
    top: 0;
    z-index: 11;
    padding-top: calc(6px - 4px * var(--sticky-compact));
    background: #fff;
}

body.edit-mode .material-heading-row {
    background: #dcdcdc;
}

.material-heading-row .material-detail-heading {
    width: 100%;
    margin: 0;
    font-size: calc(20px - 6px * var(--sticky-compact));
    line-height: 1.3;
}

/* Material box and View box: same frame, same height. */
.material-heading-row :is(.material-heading-box, .input-view-options) {
    align-self: stretch;
    align-items: center;
}

/* Edit mode: the material box (heading editor) takes the free width of the row. */
.material-heading-row .material-heading-box:has(#material-heading-editor:not([hidden])) {
    flex: 1 1 600px;
    width: auto;
}

/* View = basic: also hide calculation groups / sections left without any visible block. */
.input-view-basic :is(.step0-calculation-input-group, .step1-calculation-group, .step2-calculation-group, .step1-bands-input-group, .step1-nscf-input-group, .step1-pdos-input-group, .step1-dos-input-group, .phonon-calculation-input-group):has(fieldset.collapsible-block):not(:has(fieldset.calculation-block:not(.collapsible-block))),
.input-view-basic .step0-input-preview-section:has(fieldset.collapsible-block):not(:has(fieldset.calculation-block:not(.collapsible-block), .convergence-parameter-controls, input:not([type="hidden"]), select)) {
    display: none;
}

/* Basic view (not editing): hide convergence-parameter boxes with nothing specified. */
body:not(.edit-mode) .input-view-basic .convergence-none-specified {
    display: none;
}

/* Step 1 "Save for future Steps": the coordinates recap of later steps only in the advanced view. */
.input-view-basic .recap-advanced-only {
    display: none;
}

/* Steps 4-5: "Use converged Step 2 inputs" above the &inputepw block. */
.converged-wannier-controls {
    margin: 0 0 var(--gap-tight);
}
.converged-wannier-controls [data-converged-wannier-undo] {
    margin-left: 0.5rem;
}
/* Outside edit mode both buttons are disabled: greyed out. */
.converged-wannier-controls button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.converged-wannier-controls .phonon-placeholder-note {
    margin: 0;
}

/* Step 2: the converged button (as in Step 0) keeps its distance to the overlay group below. */
#step2-save-converged-button {
    margin-bottom: var(--gap-block);
}

/* Space groups (grit/spacegroups.py): italic Hermann-Mauguin symbol, overbar = rotoinversion. */
.spacegroup {
    white-space: nowrap;
}
.spacegroup .overbar {
    text-decoration: overline;
}
.spacegroup sub {
    font-size: 0.7em;
}

/* Landing page: shorter service buttons (same width). */
.landing-column .entry-option {
    min-height: 70px;
    font-size: 24px;
}

.landing-column .entry-options {
    gap: 16px;
}

/* Privacy row sits above Support at the bottom of the sidebar; it takes over
   the push-to-bottom margin and top line from the Support row. */
/* HIDDEN for now (re-introduce later): to show the Privacy row again, delete the
   display:none rule below and un-comment the two original rules.
.privacy-row {
    margin-top: auto;
    border-top: 2px solid #000;
}

.privacy-row + .support-row {
    margin-top: 0;
    border-top: 0;
}
*/
.menu-box li.privacy-row {
    display: none;
}

.legal-document {
    max-width: 900px;
    font-size: 17px;
    line-height: 1.45;
}

.legal-document h1 { font-size: 30px; margin: 0 0 12px 0; }
.legal-document h2 { font-size: 21px; margin: 24px 0 8px 0; }
.legal-document p { font-size: 17px; line-height: 1.45; margin: 0 0 10px 0; }
.legal-document ul { margin: 0 0 10px 0; padding-left: 26px; }
.legal-document li { margin-bottom: 6px; }

/* Small second line inside a landing-page button, e.g. "(Work in Progress)". */
.landing-column .entry-option {
    flex-direction: column;
}

.entry-option-note {
    font-size: 15px;
    font-weight: normal;
    margin-top: 4px;
}
