/* SPDX-FileCopyrightText: 2026 Wise Storage Director contributors
 * SPDX-License-Identifier: GPL-3.0-only
 */

:root {
    color-scheme: light;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    color: #1f2933;
    background: #f1f4f6;
    --color-page: #f1f4f6;
    --color-surface: #ffffff;
    --color-surface-muted: #e8edf1;
    --color-border: #cbd4dc;
    --color-border-strong: #8493a0;
    --color-text: #1f2933;
    --color-text-muted: #4b5966;
    --color-primary: #174a70;
    --color-primary-hover: #103a59;
    --color-focus: #075fcc;
    --color-error: #8b1e1e;
    --color-warning-bg: #fff4df;
    --color-warning-text: #633b00;
    --radius-small: 5px;
    --radius-medium: 8px;
    --shadow-panel: 0 1px 3px rgb(25 40 55 / 8%);
}

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

html {
    min-width: 320px;
    scroll-behavior: smooth;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--color-page);
    color: var(--color-text);
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

main {
    width: min(100%, 1480px);
    margin: 0 auto;
    padding: 20px clamp(12px, 2vw, 28px) 36px;
}

p { margin: 10px 0; }

div { display: flex; }

h1, h2, h3, h4 {
    color: #202d38;
    line-height: 1.25;
    text-decoration: none;
}
h1 { font-size: clamp(1.65rem, 3vw, 2.15rem); }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.65rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

button, input, select, textarea { font: inherit; }

button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #123d5d;
    border-radius: var(--radius-small);
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}
button:hover:not(:disabled) { background: var(--color-primary-hover); }
button:disabled { cursor: not-allowed; opacity: 0.65; }

a { color: #124f7a; text-underline-offset: 3px; }
a:hover { color: #0b3554; }

:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
}

input, select, textarea {
    min-height: 44px;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-small);
    background: #ffffff;
    color: var(--color-text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* Main content groups. */
.box-container {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 18px;
    margin: 14px 10px 20px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-muted);
}

div.header-box {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 10px 20px;
    padding: 18px 22px 18px 78px;
    border: 1px solid #123d5d;
    border-radius: var(--radius-medium);
    background: #173b56;
    box-shadow: 0 1px 3px rgb(25 40 55 / 12%);
}
.header-box h1 { margin: 0; color: #ffffff; }
.header-box p { margin: 0; color: #e4edf3; }

div.box {
    display: flex;
    flex: 1 1 240px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 0;
    margin: 10px;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 1px 3px rgb(25 40 55 / 7%);
}

div.box#settings {
    min-height: 400px;
    height: auto;
    background: var(--color-surface);
    font-size: 1rem;
}

div.box.priority-box {
    min-height: 100px;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: #e8edf2;
    font-size: 1rem;
}

#games-box { background: #e7eef5; }
#applications-box { background: #f5ebe5; }
#media-box { background: #e8f1e9; }
#documents-box { background: #f4e9e8; }
#backups-box { background: #eeeaf4; }

.hidden { display: none !important; }

img {
    display: block;
    max-width: 100%;
    height: auto;
}

div#big-start {
    flex-wrap: wrap;
    font-size: 1.25rem;
    padding: 20px;
}

/* Side navigation; width remains controlled by the existing JavaScript. */
#navOpenButton {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;

    margin: 0;
    padding: 0;

    border: 1px solid #123d5d;
    border-radius: 6px;
    background: #173b56;
    color: #ffffff;

    font-size: 24px;
    line-height: 1;
    text-align: center;
}

.sidenav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 101;
    display: block;
    width: 0;
    height: 100%;
    margin: 0;
    padding-top: 64px;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0;
    background: #172b3a;
    color: #ffffff;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    transition: width 180ms ease;
}

.sidenav a {
    display: block;
    min-height: 44px;
    padding: 10px 16px 10px 28px;
    color: #ffffff;
    font-size: 1rem;
    text-decoration: none;
}
.sidenav a:hover, .sidenav a:focus-visible {
    background: #29485f;
    color: #ffffff;
}
.sidenav .closebtn {
    position: absolute;
    top: 8px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 4px 10px;
    font-size: 1.8rem;
}
.sidenav .closebtn:hover { background: #29485f; }
.sidenav .closebtn {
    width: 44px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.sidenav .sidenav-section {
    margin: 18px 16px 4px 28px;
    color: #aebdca;
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.sidenav a.active {
    background: #29485f;
    border-left: 3px solid #91bddb;
    padding-left: 25px;
    font-weight: 700;
}
.sidenav a { transition: background-color 120ms ease; }

/* Storage usage bars. */
.storage-bar-container {
    width: 90%;
    min-height: 24px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-small);
    background: #e4e9ed;
    overflow: hidden;
}
.storage-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50%;
    height: 100%;
    min-height: 22px;
    background: #174a70;
    color: #ffffff;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

/* Dynamic drive boxes and storage bars. */
#driveContainer {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
}
#driveContainer > .box {
    flex: 1 1 280px;
    min-width: min(240px, 100%);
    margin: 0;
    gap: 8px;
    align-items: stretch;
}
#driveContainer .drive-title {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}
#driveContainer .storage-bar-container {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 24px;
    min-height: 24px;
    flex: 0 0 24px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-small);
    background: #e4e9ed;
    overflow: hidden;
}
#driveContainer .storage-bar-inner {
    display: flex;
    box-sizing: border-box;
    width: 0%;
    max-width: 100%;
    height: 100%;
    min-height: 22px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: #174a70;
    color: #ffffff;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}
#driveContainer .storage-label {
    display: block;
    margin: 4px 0 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}
#driveContainer .empty-drives-message {
    display: block;
    width: 100%;
    margin: 10px;
}
#driveContainer .drive-error-message {
    display: block;
    width: 100%;
    margin: 10px;
    color: var(--color-error);
    font-weight: 700;
}

/* Main performance graphs. */
#graph {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    gap: 16px;
    box-shadow: var(--shadow-panel);
}
#graph > h2 { display: block; margin: 0; }

#graph-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    gap: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: #edf1f4;
}
#graph-container > .box {
    display: flex;
    flex: 1 1 300px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    min-height: 300px;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    box-shadow: none;
}
#graph-container > .box > h3 {
    display: block;
    margin: 8px 0 16px;
    text-align: center;
}
#throughputChart, #iopsChart {
    display: block;
    width: 100% !important;
    max-width: 100%;
    max-height: 280px;
}

/* Process I/O table. */
#process-section {
    display: block;
    min-width: 0;
    margin: 24px;
}
#process-table-wrapper {
    display: block;
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    -webkit-overflow-scrolling: touch;
}
#process-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    color: var(--color-text);
}
#process-table th, #process-table td {
    padding: 12px;
    border-bottom: 1px solid #d9dfe4;
    text-align: left;
    white-space: nowrap;
}
#process-table th {
    background: #e8edf1;
    color: #263d50;
    font-weight: 700;
}
#process-table tbody tr { cursor: pointer; }
#process-table tbody tr:nth-child(even) { background: #f6f8fa; }
#process-table tbody tr:hover { background: #eaf1f6; }
#process-table tbody tr.selected-process-row {
    background: #dceaf5;
    outline: 2px solid #174a70;
    outline-offset: -2px;
}
#process-table tbody tr:focus-visible { outline: 3px solid var(--color-focus); outline-offset: -3px; }

.process-search-container {
    width: 100%;
    margin: 15px 0;
}
#process-search { width: 100%; max-width: 400px; }

#process-status, #selected-process {
    display: block;
    margin: 10px 0;
    color: var(--color-text-muted);
}

/* Process history graph. */
#process-history-section {
    display: block;
    min-width: 0;
    margin: 24px;
}
#history-process-select {
    display: block;
    width: 100%;
    max-width: 350px;
    margin: 10px 0;
}
#history-status {
    display: block;
    margin: 10px 0;
    color: var(--color-text-muted);
}
#process-history-chart-container {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: 400px;
    min-width: 0;
    margin: 16px 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
}
#process-history-chart-container #processHistoryChart {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* WSD recommendation panel. */
/* WSD recommendation panel. */
#recommendations-section {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    min-width: 0;
    gap: 12px;
    color: var(--color-text);
}

.recommendations-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 24px;
    width: 100%;
    margin-bottom: 16px;
}

.recommendations-header h2 {
    margin: 0;
}

.recommendations-header p {
    margin: 4px 0 0;
    color: var(--color-text-muted);
}

#refresh-recommendations-button {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 44px;
    padding: 10px 16px;
}

/* Keep recommendation cards side by side. */
#recommendations-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    width: 100%;
    align-items: stretch;
    gap: 16px;
}

.recommendation-card {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-panel);
    overflow-wrap: anywhere;
}
.recommendation-card[data-demo-preview-card="true"] { border-style: dashed; border-color: #638298; }
.recommendation-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.recommendation-title-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.recommendation-title-group h3,
.recommendation-title-group p {
    margin: 0;
}
.recommendation-subtitle {
    margin: 0;
    color: var(--color-text-muted);
    text-transform: capitalize;
}
.recommendation-badge {
    display: inline-block;
    padding: 5px 9px;
    border: 1px solid #c5cdd5;
    border-radius: var(--radius-small);
    background: #edf1f4;
    color: #293845;
    font-size: 0.75rem;
    font-weight: 700;
}
.recommendation-badge.approval-required {
    border-color: #d6a64b;
    background: #fff1cc;
    color: #633b00;
}
.recommendation-badge.demo-preview-badge { border-color: #8caec2; background: #eaf3f8; color: #28536d; }
.recommendation-detail {
    display: block;
    margin: 10px 0;
    line-height: 1.55;
}
.recommendation-card h4 { margin-bottom: 8px; }
.recommendation-constraints {
    padding-left: 22px;
    line-height: 1.6;
}
.recommendation-id {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #d9dfe4;
    color: var(--color-text-muted);
    font-size: 0.75rem;
}
.recommendation-move-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #d9dfe4;
}
.recommendation-move-status { flex: 1 1 100%; margin: 0; color: var(--color-text-muted); font-size: .86rem; line-height: 1.45; }
.recommendation-move-status[data-state="failed"] { color: #8b3028; }
.recommendation-move-status[data-state="completed"] { color: #23643b; }
.recommendation-move-button { min-width: 130px; }
.recommendations-empty {
    padding: 20px;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-medium);
    background: #f7f9fa;
    color: var(--color-text-muted);
}

/* Smaller screens: preserve content order while reducing outer spacing. */
@media (max-width: 700px) {
    .box-container, div.header-box {
        margin: 14px;
        padding: 14px;
    }
    div.box {
        margin: 6px 0;
        padding: 16px;
    }
    #process-section, #process-history-section, #recommendations-section {
        margin: 16px 0;
    }
    #recommendations-section {
        width: 100%;
        margin: 16px 0;
    }
    div.header-box { padding: 14px 14px 14px 64px; }

    .recommendations-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    #refresh-recommendations-button {
        width: 100%;
    }

    #recommendations-container {
        grid-template-columns: 1fr;
    }
    #graph { padding: 14px; }
    #graph-container { padding: 8px; gap: 12px; }
    #graph-container > .box {
        flex-basis: 100%;
        min-height: 260px;
        padding: 14px;
    }
    #process-table th, #process-table td { padding: 10px; }
    .recommendations-header { align-items: stretch; }
    #refresh-recommendations-button { width: 100%; }
}

/* Respect users who request reduced motion. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Shared layouts for the expanded monitoring pages. */
.page-intro {
    margin: 0 10px 20px;
    padding: 18px 22px 18px 78px;
    border: 1px solid #123d5d;
    border-radius: var(--radius-medium);
    background: #173b56;
    color: #e4edf3;
    box-shadow: 0 1px 3px rgb(25 40 55 / 12%);
}
.page-intro h1 { margin: 0 0 5px; color: #ffffff; }
.page-intro p { margin: 0; color: #e4edf3; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 10px 20px; }
.data-panel > .metric-grid { margin: 12px 0 0; }
.metric-tile { padding: 15px 16px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); box-shadow: 0 1px 3px rgb(25 40 55 / 6%); }
.metric-tile h2 { margin: 0 0 8px; color: var(--color-text-muted); font-size: .9rem; font-weight: 600; }
.metric-tile strong { color: #173b56; font-size: 1.25rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.data-panel { min-width: 0; margin: 14px 10px; padding: 18px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface); box-shadow: 0 1px 3px rgb(25 40 55 / 6%); }
.data-panel > h2:first-child { margin-top: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }
.data-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-small); }
.data-table { width: 100%; border-collapse: collapse; background: var(--color-surface); color: var(--color-text); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid #e0e6eb; text-align: left; }
.data-table th { background: #e8edf1; color: #263d50; font-size: .84rem; font-weight: 700; white-space: nowrap; }
.data-table tbody tr:nth-child(even) { background: #f7f9fa; }
.data-table tbody tr:hover { background: #edf3f7; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tr:last-child td { border-bottom: 0; }
.status-note { color: var(--color-text-muted); }
.notice { padding: 12px 14px; border-left: 4px solid #59758a; background: #edf1f4; color: #344552; }
.chart-panel { position: relative; height: 340px; min-width: 0; margin-top: 14px; }
.drive-warning { color: #805400; font-weight: 700; }
.recommendations-error { color: var(--color-error); font-weight: 600; }
.export-actions { display: flex; flex-wrap: wrap; gap: 10px; }
button:disabled { cursor: not-allowed; opacity: .6; }

/* Storage mode selector. Selection is a local preview until a write API exists. */
.mode-panel {
    margin: 14px 10px 20px;
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid #bdcbd5;
    border-radius: 12px;
    background: linear-gradient(140deg, #ffffff 8%, #f4f8fa 100%);
    box-shadow: 0 8px 24px rgb(25 40 55 / 8%);
}
.mode-panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}
.mode-panel-heading > div { display: block; }
.mode-panel-heading h2 { margin: 0 0 6px; font-size: clamp(1.5rem, 2.5vw, 2rem); }
.mode-panel-heading p { margin: 0; color: var(--color-text-muted); }
.mode-eyebrow {
    margin: 0 0 6px !important;
    color: #416b86 !important;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
}
.mode-preview-tag {
    flex: 0 0 auto;
    padding: 7px 11px;
    border: 1px solid #c9d6df;
    border-radius: 999px;
    background: #edf3f7;
    color: #36546a;
    font-size: .78rem;
    font-weight: 700;
}
.mode-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.mode-card {
    position: relative;
    display: block;
    min-width: 0;
    border: 2px solid #d7e0e6;
    border-radius: 12px;
    background: #ffffff;
    color: var(--color-text);
    cursor: pointer;
    box-shadow: 0 3px 10px rgb(26 47 62 / 5%);
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.mode-card:hover { border-color: #91adbf; box-shadow: 0 7px 18px rgb(26 47 62 / 10%); transform: translateY(-2px); }
.mode-card:has(.mode-radio:checked) { border-color: #1d628d; box-shadow: 0 0 0 3px rgb(29 98 141 / 13%), 0 8px 20px rgb(26 47 62 / 9%); }
.mode-card:has(.mode-radio:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.mode-radio { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-card-content { display: flex; flex-direction: column; align-items: stretch; padding: clamp(18px, 2.4vw, 28px); }
.mode-card-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.mode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: #e8f1f6;
    color: #205a7f;
    font-size: 1.6rem;
    font-weight: 700;
}
.mode-card-cache .mode-icon { background: #f4efe2; color: #81621e; }
.mode-selection-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 2px solid #c4d0d8;
    border-radius: 50%;
    color: transparent;
    font-size: 1rem;
    font-weight: 800;
}
.mode-card:has(.mode-radio:checked) .mode-selection-mark { border-color: #1d628d; background: #1d628d; color: #ffffff; }
.mode-title { display: block; margin-bottom: 8px; color: #173b56; font-size: clamp(1.15rem, 1.8vw, 1.45rem); font-weight: 750; line-height: 1.3; }
.mode-title span { color: #426277; font-weight: 600; }
.mode-description { display: block; min-height: 76px; color: #465866; line-height: 1.55; }
.storage-diagram {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 132px;
    margin: 18px 0;
    padding: 18px;
    overflow: hidden;
    border: 1px solid #e0e8ed;
    border-radius: 9px;
    background: #f6f9fb;
}
.storage-diagram.pooling-diagram, .storage-diagram.cache-diagram {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    box-sizing: border-box;
    height: 148px;
    min-height: 148px;
    padding: 12px;
}
.pooling-visual {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) 24px minmax(90px, .9fr);
    align-items: center;
    gap: 7px;
    width: 100%;
}
.pooling-sources { display: grid; gap: 5px; }
.pooling-drive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    min-height: 23px;
    padding: 3px 7px;
    border: 1px solid #aabac4;
    border-radius: 5px;
    background: #ffffff;
    color: #344c5c;
    font-size: .68rem;
}
.pooling-drive strong { white-space: nowrap; }
.pooling-drive code { overflow: hidden; color: #526a79; font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
.pooling-join { position: relative; height: 79px; }
.pooling-join::before { position: absolute; top: 12px; bottom: 12px; left: 50%; border-left: 1px solid #7691a1; content: ""; }
.pooling-join i { position: absolute; left: 0; width: 100%; border-top: 1px solid #7691a1; }
.pooling-join i:nth-child(1) { top: 12px; }
.pooling-join i:nth-child(2) { top: 39px; }
.pooling-join i:nth-child(3) { top: 66px; }
.pooling-mount {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 66px;
    padding: 6px;
    border: 1px solid #9ab7c9;
    border-radius: 7px;
    background: #e7f1f7;
    color: #205a7f;
    text-align: center;
}
.pooling-mount code { font-size: .88rem; font-weight: 750; }
.pooling-mount small { margin-top: 3px; font-size: .62rem; line-height: 1.2; }
.pooling-caption { display: block; margin-top: 7px; color: #536b79; font-size: .64rem; line-height: 1.3; text-align: center; }
.cache-diagram { align-items: center; gap: 8px; }
.cache-concept-ssd {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 48px;
    border: 1px solid #c6ae70;
    border-radius: 8px;
    background: #faf4e5;
    color: #745a1e;
}
.ssd-glyph { font-size: .9rem; font-weight: 800; letter-spacing: .08em; }
.cache-concept-label { color: #745a1e; font-size: .72rem; font-weight: 650; }
.mode-status-row { display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding-top: 2px; }
.mode-status-badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #edf1f4; color: #445560; font-size: .75rem; font-weight: 750; }
.mode-status-badge[data-state="unavailable"] { background: #f8e9e7; color: #8b3028; }
.mode-status-badge[data-state="available"] { background: #e5f2e9; color: #23643b; }
.mode-status-badge[data-state="unknown"], .mode-status-badge[data-state="loading"] { background: #edf1f4; color: #52616b; }
.mode-status-copy { color: var(--color-text-muted); font-size: .82rem; line-height: 1.45; }
.mode-selection-note { margin: 18px 0 6px; padding: 12px 14px; border-left: 4px solid #1d628d; border-radius: 0 6px 6px 0; background: #edf5f9; color: #24475d; font-weight: 700; }
.mode-capability-note { margin: 8px 0 0; color: #566671; font-size: .87rem; }
.mode-load-status { margin: 12px 0 0; font-size: .85rem; }
.mode-toast {
    position: fixed;
    z-index: 120;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    display: flex;
    align-items: center;
    gap: 9px;
    width: max-content;
    max-width: min(360px, calc(100vw - 32px));
    padding: 11px 15px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 8px;
    background: rgb(35 119 75 / 94%);
    color: #ffffff;
    box-shadow: 0 5px 16px rgb(20 40 30 / 20%);
    font-size: .9rem;
    font-weight: 650;
    pointer-events: none;
}
.mode-toast[hidden] { display: none; }
.mode-toast-icon { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; flex: 0 0 19px; border-radius: 50%; background: rgb(255 255 255 / 20%); font-size: .78rem; }
.mode-toast.is-entering { animation: mode-toast-in 180ms ease-out both; }
.mode-toast.is-leaving { animation: mode-toast-out 220ms ease-in both; }
@keyframes mode-toast-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mode-toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(8px); } }
.movement-toast-stack {
    position: fixed;
    z-index: 121;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(380px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    pointer-events: none;
}
.mode-toast.movement-toast {
    position: static;
    width: 100%;
    max-width: none;
    pointer-events: none;
}
.movement-toast[data-kind="started"] { background: rgb(36 91 122 / 96%); }
.movement-toast[data-kind="failed"] { background: rgb(145 52 45 / 96%); }
.movement-toast[data-kind="unknown"] { background: rgb(132 89 24 / 96%); }
.movement-toast[data-kind="preview"] { background: rgb(63 91 109 / 96%); }
.movement-toast-icon.is-spinning { animation: movement-toast-spin 1.1s linear infinite; }
@keyframes movement-toast-spin { to { transform: rotate(360deg); } }
.move-confirmation-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 18px 55px rgb(16 34 46 / 28%);
}
.move-confirmation-dialog::backdrop { background: rgb(14 27 36 / 58%); }
.move-confirmation-dialog h2 { margin-top: 0; }
.move-confirmation-details { margin: 18px 0; }
.move-confirmation-details > div {
    display: grid;
    grid-template-columns: minmax(132px, .38fr) minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 6px;
    align-items: start;
    margin: 14px 0;
}
.move-confirmation-details dt { font-weight: 700; }
.move-confirmation-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.move-confirmation-warning { color: #754b12; font-size: .9rem; line-height: 1.5; }
.move-confirmation-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.move-confirmation-actions .secondary-button { border-color: #536b7b; background: #536b7b; }
@media (max-width: 520px) {
    .move-confirmation-details > div {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 5px;
    }
}
.implementation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.implementation-item { padding: 16px; border: 1px solid #dce4e9; border-radius: 8px; background: #f8fafb; }
.implementation-item h3 { margin: 0 0 7px; font-size: 1rem; }
.implementation-item p { margin: 0; color: var(--color-text-muted); }

/* File I/O page uses the shared monitoring panels and chart theme. */
.file-io-callout { border-left: 4px solid #59758a; }
.file-io-callout h2 { margin-bottom: 8px; }
.file-io-callout p:last-child { margin-bottom: 0; }
.file-io-metrics .metric-tile { min-width: 0; }
.file-io-metrics .metric-tile strong { display: block; min-height: 1.6em; font-size: clamp(1rem, 1.4vw, 1.2rem); }
.file-io-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}
.file-io-section-heading > div { display: block; }
.file-io-section-heading h2 { margin: 0 0 4px; }
.file-io-section-heading p { margin: 0; color: var(--color-text-muted); }
.file-data-tag { flex: 0 0 auto; padding: 6px 10px; border: 1px solid #c9d6df; border-radius: 999px; background: #edf3f7; color: #36546a; font-size: .75rem; font-weight: 700; }
.file-io-source-toolbar { align-items: center; }
.file-io-source-toolbar select { flex: 0 0 auto; }
.file-source-status { display: inline-block; padding: 7px 10px; border-radius: 6px; background: #e8f1f6; color: #36546a; font-size: .82rem; font-weight: 700; }
.file-source-status[data-mode="mock"] { border: 1px solid #d1ae64; background: #fbf3df; color: #6c4d0e; }
.file-io-refresh-toolbar { justify-content: space-between; }
.file-io-refresh-toolbar .status-note { margin: 0; }
.file-io-toolbar { align-items: end; }
.file-io-toolbar input { flex: 1 1 220px; }
.file-io-toolbar select { flex: 0 1 auto; }
.file-io-table { width: 100%; min-width: 1000px; table-layout: fixed; }
.file-io-table th, .file-io-table td { min-width: 0; padding: 8px 7px; }
.file-io-table th { white-space: normal; line-height: 1.2; font-size: .76rem; }
.file-io-table th:nth-child(1), .file-io-table td:nth-child(1) { width: 24%; }
.file-io-table th:nth-child(2), .file-io-table td:nth-child(2) { width: 14%; }
.file-io-table th:nth-child(n+3):nth-child(-n+8), .file-io-table td:nth-child(n+3):nth-child(-n+8) { width: 7.5%; }
.file-io-table th:nth-child(9), .file-io-table td:nth-child(9) { width: 9%; }
.file-io-table th:nth-child(10), .file-io-table td:nth-child(10) { width: 8%; }
.file-io-table td.file-path-cell,
.file-io-table td.file-name-cell,
.file-io-table td.file-source-cell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-io-table tbody tr[role="button"] { cursor: pointer; }
.file-io-table tbody tr[role="button"]:focus-visible { outline: 3px solid var(--color-focus); outline-offset: -3px; }
.file-io-table tbody tr.selected-file-row { background: #dceaf5; outline: 2px solid #174a70; outline-offset: -2px; }
.file-schema-note { margin: 12px 0 0; color: var(--color-text-muted); font-size: .84rem; }
.file-history-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; width: 100%; margin-top: 18px; }
.file-history-chart-grid > .file-history-chart-card { display: flex; flex-direction: column; min-width: 0; }
.file-history-chart-card h3 { min-height: 2.5em; margin: 0; }
.file-history-chart-card .chart-panel { width: 100%; height: 320px; }
.file-history-active-files { display: grid; gap: 8px; padding-left: 28px; }
.file-history-active-files li { padding-left: 4px; }
.file-history-active-files li span { display: inline-block; max-width: min(70%, 800px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.file-history-active-files li strong { margin-left: 12px; color: var(--color-text-muted); font-size: .9rem; }
@media (max-width: 760px) {
    .file-history-chart-grid { grid-template-columns: 1fr; }
}
.file-subscription-toolbar { align-items: end; }
.file-subscription-toolbar input { flex: 1 1 320px; }
.file-subscription-toolbar .secondary-button { background: #536b7b; }
.file-subscription-table { min-width: 620px; }
.file-subscription-table td:first-child { overflow-wrap: anywhere; }
.file-move-controls { margin-top: 20px; padding-top: 16px; border-top: 1px solid #dce4e9; }
.file-move-controls > label { display: block; margin-bottom: 7px; font-weight: 600; }
.file-move-controls input { flex: 1 1 320px; }
.file-move-controls .status-note { margin-bottom: 0; }
.file-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; margin-top: 14px; }
.file-detail-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; border: 1px solid #dce4e9; border-radius: 6px; background: #f8fafb; }
.file-detail-item span { color: var(--color-text-muted); font-size: .78rem; }
.file-detail-item strong { overflow-wrap: anywhere; font-size: .92rem; font-weight: 600; }

@media (max-width: 600px) {
    .page-intro { margin: 0 0 16px; padding: 16px 16px 16px 64px; }
    .data-panel { margin: 12px 0; padding: 14px; }
    .metric-grid { margin-right: 0; margin-left: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar input, .toolbar select, .toolbar button { width: 100%; }
    .chart-panel { height: 280px; }
    .mode-panel { margin: 12px 0; padding: 16px; }
    .mode-panel-heading { flex-direction: column; gap: 10px; }
    .mode-options, .implementation-grid { grid-template-columns: 1fr; }
    .mode-card-content { padding: 18px; }
    .mode-description { min-height: 0; }
    .storage-diagram { min-height: 118px; }
    .mode-status-row { min-height: 0; }
    .file-io-section-heading { flex-direction: column; }
    .file-io-source-toolbar { align-items: stretch; }
    .file-io-source-toolbar select { width: 100%; }
    .file-io-toolbar { align-items: stretch; }
    .file-io-toolbar input, .file-io-toolbar select { width: 100%; }
    .file-history-chart-card .chart-panel { height: 280px; }
    .file-history-active-files li span { max-width: 58%; }
}

@media (min-width: 1600px) {
    div.header-box, .page-intro { padding-left: 22px; }
}
