body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.brand-logo {
    font-size: 2rem;
}

/* --- Configurator: remotes ------------------------------------------- */
/* The remotes added so far as a list, a tile per backend to add another, and
   one editor below the tiles for the remote being added or changed. */
.remotes-heading {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.8;
    margin: 18px 0 10px 0;
}

.remote-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.remote-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 6px 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    color: #fff;
}

.remote-row.editing {
    border-color: #fff;
    box-shadow: 0 0 0 2px #fff;
}

.remote-row-icon {
    flex: none;
    width: 28px;
    text-align: center;
    font-size: 1.5rem;
    line-height: 1;
}

.remote-row-icon .material-icons {
    font-size: 1.6rem;
    vertical-align: middle;
}

.remote-row-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.remote-row-name {
    font-weight: 500;
}

/* A server address or URL can be long; it is cut, not allowed to push the
   buttons off the row. */
.remote-row-detail {
    font-size: 0.82em;
    opacity: 0.75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 2px;
}

.remote-row-button {
    flex: none;
    padding: 0 8px;
}

.remote-editor {
    display: none;
    scroll-margin-top: 16px;
}

.remote-editor.open {
    display: block;
}

.remote-editor-title {
    font-size: 1.3rem;
    margin: 0 0 12px 0;
}

.remote-editor-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.remote-editor-actions .auth-continue-hint {
    margin-left: 4px;
}

.login-status {
    display: inline-block;
    margin-left: 12px;
}

.login-status:empty {
    display: none;
}
.auth-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.auth-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 18px 12px 14px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

/* Hover only where there is a pointer that hovers: on a touch screen the
   last-tapped tile would otherwise stay lit and read as selected. */
@media (hover: hover) {
    .auth-tile:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }
}

.auth-tile:active {
    transform: scale(0.98);
}

.auth-tile:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.auth-tile.selected {
    border-color: #fff;
    background-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 2px #fff;
}

.auth-icon {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    line-height: 1;
}

.auth-icon .material-icons {
    font-size: 2.2rem;
}

.auth-title {
    font-size: 1.05rem;
    font-weight: 500;
}

.auth-subtitle {
    font-size: 0.8em;
    opacity: 0.75;
    line-height: 1.3;
}

.auth-tile .experimental-badge {
    margin: 6px 0 0 0;
}

/* Phones: a compact list, icon on the left, so the settings below are not
   five screen-heights away. */
@media (max-width: 600px) {
    .auth-tiles {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .auth-tile {
        display: grid;
        grid-template-columns: 32px 1fr;
        grid-template-areas:
            "icon title"
            "icon subtitle"
            "icon badge";
        align-items: center;
        text-align: left;
        column-gap: 10px;
        row-gap: 0;
        padding: 10px 12px;
    }

    .auth-icon {
        grid-area: icon;
        height: auto;
        font-size: 1.5rem;
    }

    .auth-icon .material-icons {
        font-size: 1.6rem;
    }

    .auth-title {
        grid-area: title;
    }

    .auth-subtitle {
        grid-area: subtitle;
    }

    .auth-tile .experimental-badge {
        grid-area: badge;
        justify-self: start;
        margin-top: 4px;
    }

    .auth-settings {
        padding: 14px;
    }

    .remote-row {
        gap: 8px;
        padding-left: 10px;
    }

    .remote-row-button {
        padding: 0 4px;
    }

    /* Materialize buttons are one fixed-height line; let long labels wrap
       instead of spilling out of the button. */
    .auth-settings .btn {
        height: auto;
        min-height: 36px;
        line-height: 1.3;
        padding-top: 9px;
        padding-bottom: 9px;
        white-space: normal;
    }
}

.auth-empty {
    opacity: 0.8;
    margin: 4px 0 16px 0;
}

.auth-settings {
    display: none;
    padding: 20px;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
}

.auth-settings.active {
    display: block;
}

.experimental-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 18px;
    margin: 0 0 20px 0;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
    background-color: rgba(230, 81, 0, 0.18);
    color: #fff;
    font-size: 0.88em;
    line-height: 1.5;
}

.experimental-notice .material-icons {
    color: #ffb74d;
    flex: none;
}

.experimental-notice a {
    color: #fff;
    text-decoration: underline;
}

.auth-continue-hint {
    margin-left: 12px;
    font-size: 0.88em;
}

.auth-continue-hint.warn {
    color: #ffcc80 !important;
}

.panel-intro {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0 0 12px 0;
}

.field-note {
    font-size: 0.85em;
    min-height: 1em;
    margin: 0 0 12px 0;
}

.field-note.warn {
    color: #ffcc80 !important;
}

.experimental-badge {
    display: inline-block;
    background: #e65100;
    color: #fff;
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 0.62rem;
    line-height: 1.3;
    vertical-align: middle;
    margin-left: 12px;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.select-label {
    display: block;
    position: static;
    font-size: 0.85em;
    line-height: 1.4;
    margin: 0 0 6px 0;
}

.dark-select {
    display: block;
    width: 100%;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    height: 2.6rem;
    margin-bottom: 14px;
}

.dark-select option {
    color: #000;
}

.remote-security-note {
    font-size: 0.85em;
    margin-top: 24px;
}

.remote-security-note .material-icons {
    font-size: 1.3rem;
}

.config-preview {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 0.85em;
    overflow-x: auto;
    white-space: pre;
}

/* An invalid field shows its error in place of the hint.  Materialize draws
   the error as an absolutely placed ::after over a hint it makes transparent,
   but .white-text keeps the hint visible here, and a hint that wraps would sit
   under the error.  So: hide the hint's own text and let the error take its
   place in the flow, wrapping as far as it needs. */
.input-field input.remote-field.invalid~.helper-text {
    font-size: 0 !important;
}

.input-field input.remote-field.invalid~.helper-text::after {
    position: static;
    font-size: 12px;
    color: #ff8a80 !important;
}

/* --- Configurator: test connection ------------------------------------- */
.test-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0 4px 0;
}

.test-result {
    font-size: 0.88em;
    line-height: 1.4;
    flex: 1 1 240px;
}

.test-result .material-icons {
    font-size: 1.1em;
    vertical-align: -2px;
    margin-right: 4px;
}

.test-result.ok {
    color: #b9f6ca;
}

.test-result.fail {
    color: #ff8a80;
}

.test-result.unknown {
    color: #ffcc80;
}

.test-unavailable {
    align-items: flex-start;
    flex-wrap: nowrap;
    padding: 12px 14px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.15);
    color: #fff;
    font-size: 0.85em;
    line-height: 1.5;
}

.test-unavailable .material-icons {
    flex: none;
    font-size: 1.3rem;
    opacity: 0.8;
}

/* --- Configurator: least-privilege tips -------------------------------- */
.privilege-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0 0 16px 0;
    padding: 10px 14px;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.15);
}

.privilege-tip .material-icons {
    flex: none;
    font-size: 1.2rem;
    color: #b9f6ca;
}

.privilege-tip a {
    color: #fff;
    text-decoration: underline;
}

/* --- Configurator: steps already passed can be reopened ----------------- */
.stepper > li.step.step-reachable > .step-title {
    cursor: pointer;
}

.stepper > li.step.step-reachable > .step-title:hover,
.stepper > li.step.step-reachable > .step-title:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

/* --- Configurator: remotes per folder ----------------------------------- */
.routing-section {
    display: none;
}

.routing-table {
    overflow-x: auto;
}

.routing-table table {
    color: #fff;
    margin-bottom: 8px;
}

.routing-table th,
.routing-table td {
    padding: 6px 10px;
    white-space: nowrap;
}

.routing-table th:not(:first-child),
.routing-table td:not(:first-child) {
    text-align: center;
}

/* Materialize draws the box in the span's padding; with no text beside it,
   the label must still be as tall as the box. */
.routing-table label span {
    padding-left: 18px;
    height: 20px;
}

.routing-table td.routing-na {
    opacity: 0.6;
    cursor: help;
}

.routing-empty {
    opacity: 0.75;
}

/* Step 2: a file type list per folder. */
.folder-filters-section .panel-intro {
    margin-bottom: 1.8rem;
}

.folder-filter-row {
    margin-top: 0;
    margin-bottom: 1.6rem;
}

.folder-filter-row input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

/* Step 1: import a file made before. */
.import-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin: 0.5rem 0 1.2rem 0;
}

.import-button {
    font-size: inherit;
    text-transform: none;
}

.import-intro {
    flex: 1 1 18rem;
    font-size: 0.9em;
    opacity: 0.85;
}

.import-status {
    flex: 1 1 100%;
    font-size: 0.9em;
}

.import-status:empty {
    display: none;
}

.import-status ul {
    margin: 0.3rem 0 0 0;
}

.import-status li {
    list-style: disc;
    margin-left: 1.2rem;
}

.import-status.warn li.problem {
    color: #ffcc80;
}

/* WebDAV and FTP: VerifyTLS=false. */
.cert-option {
    margin: 0.2rem 0 0.8rem 0;
}
