html {
    font-size: 75%;
}

:root,
html[data-theme="dark"] {
    --bg: #0f172a;
    --bg-gradient: linear-gradient(160deg, #0f172a 0%, #1e293b 45%, #0b1220 100%);
    --sidebar-bg: #0f172a;
    --surface: rgba(30, 41, 59, 0.9);
    --surface-solid: #1e293b;
    --input-bg: #0f172a;
    --border: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(148, 163, 184, 0.35);
    --text: #e2e8f0;
    --text-strong: #f8fafc;
    --muted: #94a3b8;
    --label: #cbd5e1;
    --brand: #38bdf8;
    --accent: #0ea5e9;
    --accent-text: #0f172a;
    --link: #7dd3fc;
    --error: #fca5a5;
    --error-list: #fecaca;
    --nav-text: #cbd5e1;
    --nav-hover: rgba(148, 163, 184, 0.12);
    --nav-active-bg: rgba(14, 165, 233, 0.18);
    --nav-active-text: #7dd3fc;
    --btn-secondary-bg: #334155;
    --btn-secondary-text: #e2e8f0;
    --table-border: rgba(148, 163, 184, 0.15);
    --modal-backdrop: rgba(2, 6, 23, 0.72);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --badge-ok-bg: #14532d;
    --badge-ok-fg: #bbf7d0;
    --badge-warn-bg: #78350f;
    --badge-warn-fg: #fde68a;
    --badge-err-bg: #7f1d1d;
    --badge-err-fg: #fecaca;
    --badge-off-bg: #334155;
    --badge-off-fg: #cbd5e1;
    --badge-unk-bg: #1e293b;
    --badge-unk-fg: #94a3b8;
    --badge-pending-bg: #1e3a5f;
    --badge-pending-fg: #93c5fd;
    --mysql-grid-bg: rgba(15, 23, 42, 0.45);
    --hb-meta-strong: #f1f5f9;
    --hb-eta: #7dd3fc;
    --hb-bar-bg: rgba(51, 65, 85, 0.9);
}

html[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-gradient: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 45%, #f1f5f9 100%);
    --sidebar-bg: #ffffff;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --input-bg: #f8fafc;
    --border: rgba(15, 23, 42, 0.12);
    --border-strong: rgba(15, 23, 42, 0.22);
    --text: #1e293b;
    --text-strong: #0f172a;
    --muted: #64748b;
    --label: #334155;
    --brand: #0284c7;
    --accent: #0ea5e9;
    --accent-text: #0f172a;
    --link: #0369a1;
    --error: #b91c1c;
    --error-list: #991b1b;
    --nav-text: #334155;
    --nav-hover: rgba(14, 165, 233, 0.1);
    --nav-active-bg: rgba(14, 165, 233, 0.16);
    --nav-active-text: #0369a1;
    --btn-secondary-bg: #e2e8f0;
    --btn-secondary-text: #0f172a;
    --table-border: rgba(15, 23, 42, 0.1);
    --modal-backdrop: rgba(15, 23, 42, 0.45);
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --badge-ok-bg: #dcfce7;
    --badge-ok-fg: #14532d;
    --badge-warn-bg: #fef3c7;
    --badge-warn-fg: #92400e;
    --badge-err-bg: #fee2e2;
    --badge-err-fg: #991b1b;
    --badge-off-bg: #e2e8f0;
    --badge-off-fg: #334155;
    --badge-unk-bg: #f1f5f9;
    --badge-unk-fg: #64748b;
    --badge-pending-bg: #dbeafe;
    --badge-pending-fg: #1e40af;
    --mysql-grid-bg: rgba(241, 245, 249, 0.9);
    --hb-meta-strong: #0f172a;
    --hb-eta: #0369a1;
    --hb-bar-bg: #e2e8f0;
}

html, body {
    font-family: "Segoe UI", system-ui, sans-serif;
    margin: 0;
    background: var(--bg);
    height: 100%;
}

body {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.45;
    overflow: hidden;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

* { box-sizing: border-box; }

h1, h2, h3 { margin-top: 0; color: var(--text-strong); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--table-border);
    vertical-align: top;
}

/* Righe log espandibili (dettaglio nascosto fino al click) */
.log-expand-cell { width: 2.1rem; padding: 0.45rem 0.25rem !important; }
.log-expand-btn {
    width: 1.45rem;
    height: 1.45rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--card-bg, var(--sidebar-bg));
    cursor: pointer;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--muted);
}
.log-expand-btn:hover { color: var(--text-strong); border-color: var(--accent); }
.log-row-clickable { cursor: pointer; }
.log-row-clickable:hover > td { background: rgba(127, 127, 127, 0.12); }
.log-detail-row > td {
    padding-top: 0 !important;
    border-top: none !important;
    background: rgba(0, 0, 0, 0.04);
}
.log-detail-pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 0.35rem;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    font-size: 0.82rem;
    max-height: 280px;
    overflow: auto;
    background: rgba(0, 0, 0, 0.12);
}
.log-detail-pre.error { color: var(--error); }
.log-detail-pre.muted { color: var(--muted); }

.table a { color: var(--link); text-decoration: none; }
.table a:hover { text-decoration: underline; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-online { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.badge-warning { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge-error { background: var(--badge-err-bg); color: var(--badge-err-fg); }
.badge-offline { background: var(--badge-off-bg); color: var(--badge-off-fg); }
.badge-unknown { background: var(--badge-unk-bg); color: var(--badge-unk-fg); }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-fg); }

.btn {
    display: inline-block;
    border: 1px solid var(--border-strong);
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-row { margin-bottom: 0.85rem; }
.form-row label { display: block; margin-bottom: 0.3rem; color: var(--label); }
.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    max-width: 420px;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--text-strong);
}

.muted { color: var(--muted); }
.error { color: var(--error); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* Menu app (Macchine/Clienti/Impostazioni) — stesso stile del menu macchina */
.app-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    background: var(--bg-gradient);
    color: var(--text);
}
.app-shell .sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}
.app-shell .sidebar-brand {
    padding: 0.35rem 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}
.brand-logo {
    display: block;
    margin: 0 0 0.65rem;
    padding: 0.45rem 0.55rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid var(--border);
    line-height: 0;
    text-decoration: none;
}
.brand-logo img {
    display: block;
    width: 100%;
    max-width: 148px;
    height: auto;
}
.brand-logo:hover {
    border-color: var(--border-strong);
}
.app-shell .sidebar .brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--brand);
    text-decoration: none;
    font-size: 1.15rem;
    display: block;
}
.app-shell .sidebar-sub {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    line-height: 1.35;
}
.app-shell .sidebar-version {
    font-size: 0.72rem;
    margin-top: 0.2rem;
    line-height: 1.3;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.85;
}
.app-shell .sidebar .nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    overflow: auto;
}
.app-shell .sidebar .nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--nav-text);
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 560;
    text-decoration: none;
}
.app-shell .sidebar .nav-item:hover {
    background: var(--nav-hover);
    color: var(--text-strong);
}
.app-shell .sidebar .nav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    box-shadow: inset 3px 0 0 var(--accent);
}
.app-shell .sidebar .nav-item .nav-ico {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    opacity: 0.9;
}
.app-shell .sidebar .nav-item.active .nav-ico { opacity: 1; }
.app-shell .sidebar-foot {
    display: flex;
    gap: 0.4rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.app-shell .sidebar-foot .btn,
.app-shell .sidebar-foot .logout-form {
    flex: 1;
    min-width: 0;
}
.app-shell .content {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 1.25rem 1.5rem 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}
.content-body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.75rem;
}
.hub-commands-dock {
    flex: 0 0 auto;
    margin: 0 -1.5rem 0;
    padding: 0.65rem 1.5rem 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    z-index: 5;
}
.hub-commands-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.hub-commands-head-tools {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-left: auto;
}
.hub-commands-filter {
    min-width: 14rem;
    max-width: 22rem;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-solid, var(--sidebar-bg));
    color: var(--text);
    font-size: 0.82rem;
}
.hub-commands-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
}
.hub-commands-meta {
    font-size: 0.78rem;
    white-space: nowrap;
}
.hub-commands-scroll {
    max-height: 14rem;
    overflow: auto;
}
.hub-commands-table {
    margin: 0;
}
.hub-commands-table th {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
}
.hub-commands-table td {
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
}
.nav-toggle {
    display: none;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-strong);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 1.1rem;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.sidebar-brand-row {
    display: block;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
        align-content: start;
        grid-template-rows: auto auto;
    }
    .app-shell .sidebar {
        position: static;
        height: auto;
        min-height: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .app-shell .sidebar .nav { flex-direction: row; flex-wrap: wrap; }
    .app-shell .sidebar .nav-item.active { box-shadow: none; }
}

@media (max-width: 700px) {
    html, body {
        height: auto;
        min-height: 100%;
        overflow: auto;
    }
    .app-shell {
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
        align-content: start;
        align-items: stretch;
        grid-template-rows: auto auto;
    }
    .app-shell .content {
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
        padding: 0.85rem 0.85rem 0;
    }
    .content-body {
        flex: none;
        overflow: visible;
        padding-bottom: 1rem;
    }
    .app-shell .sidebar {
        padding: 0.55rem 0.7rem 0.5rem;
        height: auto;
        max-height: none;
    }
    .app-shell .sidebar-brand {
        padding: 0.15rem 0.15rem 0.45rem;
        margin-bottom: 0;
        border-bottom: none;
    }
    .app-shell.nav-open .sidebar-brand {
        border-bottom: 1px solid var(--border);
        margin-bottom: 0.45rem;
    }
    .app-shell .sidebar .nav {
        flex: none;
    }
    .sidebar-brand-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.6rem;
        margin-bottom: 0;
    }
    .brand-logo {
        margin: 0;
        padding: 0.28rem 0.4rem;
        flex: 1;
        min-width: 0;
    }
    .brand-logo img { max-width: 120px; }
    .app-shell .sidebar .brand { font-size: 1.02rem; }
    .app-shell .sidebar-sub { display: none; }
    .nav-toggle { display: inline-flex; }
    .app-shell .sidebar .nav,
    .app-shell .sidebar-foot {
        display: none;
    }
    .app-shell.nav-open .nav,
    .app-shell.nav-open .sidebar-foot {
        display: flex;
    }
    .app-shell.nav-open .nav {
        flex-direction: column;
        flex-wrap: nowrap;
        margin-top: 0.35rem;
    }
    .app-shell.nav-open .sidebar-foot {
        margin-top: 0.5rem;
    }
    .hub-commands-dock {
        margin: 0 -0.85rem 0;
        padding: 0.55rem 0.85rem 0.75rem;
    }
    .hub-commands-filter { min-width: 0; width: 100%; max-width: none; }
    .hub-commands-scroll { overflow-x: auto; }
    .hub-commands-table { min-width: 36rem; }
    .alert-banner {
        padding: 0.75rem 0.85rem;
        font-size: 0.92rem;
        word-break: break-word;
    }
    .alert-banner ul { margin-left: 0.9rem; }
}

/* Stesso stile menu agent: sidebar piatta + nav-item trasparenti */
.detail-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    gap: 0;
    align-items: stretch;
    margin: -1.25rem -1.5rem 0;
    min-height: min(100%, 100%);
}
.detail-shell-fill {
    height: 100%;
    min-height: 0;
}
.detail-nav {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100%;
    height: auto;
    min-height: 100%;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: 1rem 0.75rem;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}
.detail-nav-brand {
    padding: 0.35rem 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}
.detail-nav-brand a {
    color: var(--brand);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
}
.detail-nav .nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    overflow: auto;
}
.detail-nav .nav-item {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--nav-text);
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 560;
    text-decoration: none;
}
.detail-nav .nav-item > .nav-ico {
    margin-top: 0.12rem;
}
.detail-nav .nav-item:hover,
.nav-item:hover {
    background: var(--nav-hover);
    color: var(--text-strong);
}
.detail-nav .nav-item.active,
.nav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-text);
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
    line-height: 1.2;
}
.nav-item-meta {
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
/* Pallino rosso: errori nell'ultimo backup (menu sidebar / detail) */
.nav-alarm-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    min-width: 0.5rem;
    min-height: 0.5rem;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    align-self: center;
    box-shadow: 0 0 0 2px color-mix(in srgb, #ef4444 28%, transparent);
}
.nav-status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    min-width: 0.5rem;
    min-height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.nav-status-dot-muted {
    background: #64748b;
    box-shadow: 0 0 0 2px color-mix(in srgb, #64748b 22%, transparent);
}
.nav-status-dot-ok {
    background: #22c55e;
    box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 28%, transparent);
}
.nav-status-dot-warning {
    background: #b45309;
    box-shadow: 0 0 0 2px color-mix(in srgb, #b45309 28%, transparent);
}
.app-shell .sidebar .nav-item > .nav-alarm-dot {
    margin-left: auto;
}
.nav-item-label-row .nav-status-dot,
.nav-item-label-row .nav-alarm-dot {
    margin-left: 0;
}
.nav-item-body .nav-alarm-dot {
    margin-left: 0;
    align-self: flex-start;
    margin-top: 0.2rem;
}
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 0.45rem 0.75rem;
}
.nav-item.nav-item-danger {
    color: #f87171;
}
.nav-item.nav-item-danger.active {
    border-color: color-mix(in srgb, #b91c1c 55%, var(--border));
    background: color-mix(in srgb, #b91c1c 10%, transparent);
    color: #fca5a5;
}
.detail-nav-machine {
    cursor: default;
}
.danger-card {
    border-color: color-mix(in srgb, #b91c1c 35%, var(--border));
}
.nav-item-label-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}
.nav-item-label-row > span:first-child {
    min-width: 0;
}
.nav-text-short { display: none; }
.space-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    min-width: 0.55rem;
    min-height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.space-dot.ok { background: #22c55e; }
.space-dot.warn { background: #f59e0b; }
.space-dot.danger { background: #ef4444; }
.space-dot.unknown { background: #64748b; }
.space-fill-bar {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--hb-bar-bg);
    overflow: hidden;
    margin-top: 0.15rem;
}
.space-fill-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
}
.space-fill-bar.ok > span { background: #22c55e; }
.space-fill-bar.warn > span { background: #f59e0b; }
.space-fill-bar.danger > span { background: #ef4444; }

.detail-block {
    max-width: 480px;
    margin: 0.75rem 0;
}
.detail-block-narrow { max-width: 420px; }

:root {
    --pie-mysql: #3b82f6;
    --pie-disk: #a855f7;
    --pie-kopia: #22c55e;
    --pie-free: #475569;
    --pie-other: #94a3b8;
}
.storage-pie-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}
.storage-pie {
    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.storage-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}
.storage-pie-legend li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.storage-pie-swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 2px;
    flex-shrink: 0;
}
.storage-pie-swatch-mysql { background: var(--pie-mysql); }
.storage-pie-swatch-disk { background: var(--pie-disk); }
.storage-pie-swatch-kopia { background: var(--pie-kopia); }
.storage-pie-swatch-free { background: var(--pie-free); }
.storage-pie-swatch-other { background: var(--pie-other); }

.nav-ico {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.nav-item.active .nav-ico,
.detail-nav .nav-item.active .nav-ico { opacity: 1; }
.detail-main {
    min-width: 0;
    padding: 1.25rem 1.5rem 2rem;
    background: var(--bg-gradient);
}
.detail-main-fill {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding-bottom: 1rem;
}
.snapshots-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-bottom: 0;
}
.snapshots-panel-head {
    flex-shrink: 0;
}
.snapshots-table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    margin-top: 0.75rem;
    border: 1px solid var(--table-border);
    border-radius: 8px;
}
.snapshots-table {
    margin: 0;
}
.snapshots-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-solid);
    box-shadow: 0 1px 0 var(--table-border);
}
@media (max-width: 900px) {
    .detail-shell {
        grid-template-columns: 1fr;
        margin: 0;
        min-height: 0;
        height: auto;
    }
    .detail-shell-fill {
        height: auto;
        min-height: 0;
    }
    .detail-main-fill {
        min-height: 0;
    }
    .detail-nav {
        position: static;
        height: auto;
        min-height: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .detail-nav .nav {
        flex-direction: row;
        flex-wrap: wrap;
        flex: none;
        overflow: visible;
    }
    .detail-nav .nav-item {
        width: auto;
        flex: 0 0 auto;
    }
    .detail-nav .nav-item.active { box-shadow: none; }
    .detail-main { padding: 0; background: transparent; }
}
@media (max-width: 700px) {
    .detail-nav {
        padding: 0.45rem 0.15rem 0.55rem;
    }
    .detail-nav-brand {
        padding: 0 0.15rem 0.4rem;
        margin-bottom: 0.4rem;
    }
    .detail-nav-machine { display: none; }
    .detail-nav .nav {
        flex-wrap: wrap;
        overflow: visible;
        gap: 0.3rem;
        padding-bottom: 0;
    }
    .detail-nav .nav-item {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.38rem 0.5rem;
        font-size: 0.8rem;
    }
    .detail-nav .nav-item > .nav-ico {
        width: 0.95rem;
        height: 0.95rem;
        margin-top: 0.08rem;
    }
    .detail-nav .nav-item-meta,
    .detail-nav .space-fill-bar {
        display: none;
    }
    .detail-nav .nav-divider {
        display: none;
    }
    .detail-nav .nav-text-full { display: none; }
    .detail-nav .nav-text-short { display: inline; }
    .detail-block,
    .detail-block-narrow { max-width: none; }
    .detail-main .card {
        padding: 0.85rem 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .detail-main .alert-banner,
    .detail-main .health-reasons-box {
        white-space: normal;
        overflow: visible;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .detail-main .alert-banner .btn,
    .detail-main .alert-banner .btn-ack {
        display: inline-flex;
        margin: 0.45rem 0.4rem 0 0;
    }
    .storage-pie-wrap {
        flex-direction: column;
        align-items: flex-start;
    }
    .storage-pie {
        width: 7.2rem;
        height: 7.2rem;
    }
    .panel-page-header h1 { font-size: 1.25rem; }
    .modal-card,
    .modal-card-wide {
        max-width: calc(100vw - 1.2rem);
        padding: 1rem 0.9rem;
    }
}

.sources-policy-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.collapse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    text-align: left;
}
.collapse-head h2 { margin: 0; }
.collapse-head:hover h2 { color: var(--link); }
.collapse-chevron {
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
}
.section-divider {
    height: 1px;
    margin: 1rem 0 0.85rem;
    background: var(--border);
}
.policy-card .form-row input,
.policy-card .form-row textarea,
.policy-card .form-row select {
    max-width: 100%;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 1.25rem 1.4rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow);
    color: var(--text);
}

.modal-card-wide { max-width: 720px; }
.modal-card-scroll {
    max-height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
}
.modal-card-scroll h2 {
    flex-shrink: 0;
    margin: 0 0 0.75rem;
}
.modal-card-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(65vh, 640px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.35rem;
    margin-right: -0.15rem;
}
.modal-card-foot {
    flex-shrink: 0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.path-picker-card { max-width: 560px; }
.path-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}
.path-input-row input { flex: 1; min-width: 0; }
.path-picker-hint { font-size: 0.85rem; margin: 0 0 0.75rem; }
.path-picker-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.path-picker-current {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    word-break: break-all;
}
.path-picker-list {
    max-height: 16rem;
    overflow: auto;
    border: 1px solid var(--table-border);
    border-radius: 8px;
    margin-bottom: 1rem;
}
.path-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--table-border);
    background: transparent;
    color: var(--text);
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    font: inherit;
}
.path-picker-item:last-child { border-bottom: none; }
.path-picker-item:hover { background: var(--nav-hover); }
.path-picker-ico { opacity: 0.85; }

.badge-btn {
    border: none;
    cursor: pointer;
    font: inherit;
    line-height: inherit;
}
.badge-btn:hover { filter: brightness(1.15); }
.badge-btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.run-outcome {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}
.run-outcome-ok { color: #3dd68c; }
.run-outcome-warn { color: #e6a817; }
.run-outcome-err { color: #f07070; }
.run-outcome-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.run-outcome-btn:hover { filter: brightness(1.2); }
.run-outcome-btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.error-list {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    color: var(--error-list);
}
.error-list li { margin: 0.35rem 0; white-space: pre-wrap; word-break: break-word; }

.ai-analysis-box {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface-elevated, rgba(255, 255, 255, 0.04));
}
.ai-analysis-box.ai-analysis-error {
    border-color: #f87171;
    background: rgba(127, 29, 29, 0.15);
}
.ai-analysis-title {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 650;
    color: var(--text-strong);
}
.ai-analysis-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text);
}

.alert-banner {
    background: linear-gradient(90deg, #7f1d1d, #b91c1c);
    border: 1px solid #fca5a5;
    color: #fff;
    border-radius: 12px;
    padding: 0.9rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(127, 29, 29, 0.35);
    animation: alarm-pulse 1.6s ease-in-out infinite;
}

.alert-banner a { color: #fef08a; font-weight: 600; }
.alert-banner ul { margin: 0.45rem 0 0 1.1rem; padding: 0; }
.alert-banner li { margin: 0.2rem 0; }

@keyframes alarm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15); }
}

.row-alarm td {
    background: rgba(127, 29, 29, 0.28) !important;
}
html[data-theme="light"] .row-alarm td {
    background: rgba(254, 202, 202, 0.55) !important;
}

.alarm-pill {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #b91c1c;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.alarm-pill-backup { background: #c2410c; }
.alarm-pill-version { background: #b45309; }

.panel-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.panel-page-header h1,
.panel-page-header h2 {
    margin: 0;
    flex: 1 1 auto;
}

.panel-nav-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
}

.panel-nav-status-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
}

.panel-nav-status-badge-error { background: #b91c1c; color: #fff; }
.panel-nav-status-badge-warn { background: #b45309; color: #fff; }
.panel-nav-status-badge-muted { background: #475569; color: #e2e8f0; }

.health-reasons-box {
    padding: 0.65rem 0.85rem;
    border-radius: 0.45rem;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(127, 29, 29, 0.22);
    font-size: 0.88rem;
    line-height: 1.45;
}
html[data-theme="light"] .health-reasons-box {
    background: rgba(254, 226, 226, 0.75);
    border-color: rgba(220, 38, 38, 0.35);
}
.health-reasons-warning {
    border-color: rgba(234, 179, 8, 0.4);
    background: rgba(120, 53, 15, 0.25);
}
html[data-theme="light"] .health-reasons-warning {
    background: rgba(254, 243, 199, 0.85);
    border-color: rgba(217, 119, 6, 0.35);
}
.health-reasons-list {
    margin: 0.35rem 0 0;
    padding-left: 1.2rem;
}
.health-reasons-list li {
    margin: 0.2rem 0;
}

.nav-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    margin-left: auto;
}
html[data-theme="light"] .nav-count-badge {
    background: #b91c1c;
}

.problems-panel-empty {
    padding: 1rem 0;
    color: var(--muted, #94a3b8);
}
.problems-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.problems-table th,
.problems-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    vertical-align: top;
    text-align: left;
}
.problems-table tr.problem-acked td {
    opacity: 0.65;
}
.problem-detected-at {
    font-size: 0.82rem;
    color: var(--muted, #94a3b8);
    white-space: nowrap;
}
.problem-severity {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.problem-severity-error { background: rgba(220, 38, 38, 0.25); color: #fca5a5; }
.problem-severity-warning { background: rgba(217, 119, 6, 0.25); color: #fcd34d; }
.problem-severity-info { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
html[data-theme="light"] .problem-severity-error { color: #991b1b; }
html[data-theme="light"] .problem-severity-warning { color: #92400e; }
.problem-ack-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--muted, #94a3b8);
    margin-top: 0.25rem;
}

.source-schedule-missing {
    color: #f87171;
    font-weight: 600;
}
html[data-theme="light"] .source-schedule-missing {
    color: #b91c1c;
}
.source-schedule-ok {
    color: var(--muted, #94a3b8);
}

.alert-banner-backup {
    background: linear-gradient(90deg, #7c2d12, #c2410c);
    border-color: #fdba74;
}
.alert-banner-ack {
    background: linear-gradient(90deg, #14532d, #15803d);
    border-color: #86efac;
    color: #ecfdf5;
}
.btn-ack {
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #fcd34d;
}
.btn-ack:hover { filter: brightness(1.05); }
.row-ack td { background: rgba(21, 128, 61, 0.12) !important; }
.alert-banner-version {
    background: linear-gradient(90deg, #78350f, #d97706);
    border-color: #fcd34d;
    color: #fffbeb;
}
.alert-banner-version a { color: #fef08a; font-weight: 600; }
.alert-banner-version .btn {
    background: #fef3c7;
    color: #78350f;
    border: none;
}

.row-version td {
    background: rgba(120, 53, 15, 0.28) !important;
}
html[data-theme="light"] .row-version td {
    background: rgba(254, 243, 199, 0.7) !important;
}

.version-outdated {
    color: #fbbf24;
    font-weight: 700;
}
html[data-theme="light"] .version-outdated {
    color: #b45309;
}

.job-progress {
    margin: 0.65rem 0 0.25rem;
}
.job-progress .run-feedback { margin: 0 0 0.4rem; }
.job-progress-bar {
    width: 100%;
    max-width: 28rem;
    height: 8px;
    border-radius: 999px;
    background: var(--hb-bar-bg);
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.job-progress-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.35s ease;
}
.job-progress-pct {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.mysql-db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.35rem 0.75rem;
    margin: 0.75rem 0;
    max-height: 260px;
    overflow: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--mysql-grid-bg);
}

.mysql-db-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.mysql-db-item input {
    width: auto;
    max-width: none;
}

.bh-wrap { min-width: 210px; }

.machines-table-wrap { overflow-x: auto; }
.machines-cards { display: none; }

.machine-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    background: var(--surface);
}
.machine-card.row-alarm {
    background: rgba(127, 29, 29, 0.28);
}
html[data-theme="light"] .machine-card.row-alarm {
    background: rgba(254, 202, 202, 0.45);
}
.machine-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}
.machine-card-name {
    font-weight: 650;
    font-size: 1.02rem;
}
.machine-card-sub { font-size: 0.78rem; margin-top: 0.15rem; }
.machine-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.45rem 0 0.55rem;
}
.machine-card-pills .alarm-pill,
.machine-card-pills .badge { margin-left: 0; }
.machine-card-bar { margin: 0.35rem 0 0.65rem; }
.machine-card-bar .bh-wrap { min-width: 0; width: 100%; }
.machine-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 0.75rem;
    font-size: 0.82rem;
}
.machine-card-meta .muted {
    display: block;
    font-size: 0.7rem;
    margin-bottom: 0.1rem;
}
.machine-card-actions { margin-top: 0.7rem; }

@media (max-width: 700px) {
    .machines-table-wrap { display: none; }
    .machines-cards { display: flex; flex-direction: column; gap: 0.75rem; }
    .bh-wrap { min-width: 0; }
    .bh-legend { flex-wrap: wrap; }
}

.bh-bar {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 22px;
    padding: 2px 0;
}

.bh-seg {
    flex: 1 1 0;
    min-width: 4px;
    border-radius: 2px;
    background: #475569;
}

.bh-seg.success { background: #22c55e; }
.bh-seg.warning { background: #f59e0b; }
.bh-seg.failed { background: #ef4444; }
.bh-seg.progress { background: #eab308; }
.bh-seg.none { background: #64748b; opacity: 0.55; }

.bh-legend {
    display: flex;
    gap: 0.55rem;
    font-size: 0.68rem;
    margin-top: 0.2rem;
}

.bh-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.bh-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
}

.bh-dot.success { background: #22c55e; }
.bh-dot.warning { background: #f59e0b; }
.bh-dot.failed { background: #ef4444; }
.bh-dot.none { background: #64748b; }

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
    background: #64748b;
}

.status-dot.success { background: #22c55e; }
.status-dot.warning { background: #f59e0b; }
.status-dot.failed { background: #ef4444; }
.status-dot.progress { background: #eab308; }

.hb-block { min-width: 200px; }

.hb-meta {
    display: grid;
    gap: 0.15rem;
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.hb-meta strong {
    display: inline-block;
    margin-left: 0.35rem;
    font-weight: 600;
    color: var(--hb-meta-strong);
}

.hb-eta {
    color: var(--hb-eta);
    font-weight: 600;
    margin-top: 0.15rem;
}

.hb-eta.hb-late { color: var(--error); }

.hb-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--hb-bar-bg);
    overflow: hidden;
    border: 1px solid var(--border-strong);
}

.hb-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    transition: width 0.4s linear;
}

.hb-bar-fill.late {
    width: 100% !important;
    background: linear-gradient(90deg, #b91c1c, #f87171);
    animation: hb-pulse 1.2s ease-in-out infinite;
}

@keyframes hb-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

#blazor-error-ui {
    background: #b91c1c;
    bottom: 0;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.3);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}

#blazor-error-ui .reload { color: white; margin-left: 0.5rem; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.6rem; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.action-toast {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    font-weight: 560;
}
.action-toast.ok { border-color: rgba(14, 165, 233, 0.45); }
.action-toast.err { border-color: rgba(239, 68, 68, 0.45); color: var(--error); }
.action-toast-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: toast-pulse 1s ease-in-out infinite;
}
.action-toast.err .action-toast-dot { background: #ef4444; animation: none; }
.action-toast-close {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}
@keyframes toast-pulse {
    0%, 100% { opacity: 0.45; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.run-feedback {
    margin: 0.35rem 0 0.75rem;
    color: var(--link);
    font-size: 0.9rem;
    font-weight: 560;
}

.btn-busy {
    position: relative;
    padding-left: 1.85rem !important;
}
.btn-pending:not(.btn-danger):not(.btn-secondary) {
    background: #d97706;
    border-color: #b45309;
    color: #fff;
}
.btn-pending.btn-secondary {
    border-color: #d97706;
    color: #d97706;
}
.btn-pending.btn-danger {
    background: #991b1b;
    border-color: #7f1d1d;
}
.btn-busy::before {
    content: "";
    position: absolute;
    left: 0.65rem;
    top: 50%;
    width: 0.75rem;
    height: 0.75rem;
    margin-top: -0.375rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.active-tasks {
    margin: 0.75rem 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2, rgba(255, 255, 255, 0.02));
}
.active-tasks-busy {
    border-color: rgba(14, 165, 233, 0.35);
    background: rgba(14, 165, 233, 0.06);
}
.active-tasks-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.active-tasks-head h3 {
    margin: 0;
    font-size: 0.95rem;
}
.active-tasks-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.2);
    color: var(--link);
    font-size: 0.75rem;
    font-weight: 700;
}
.active-tasks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.active-task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}
.active-task-spinner {
    flex: 0 0 auto;
    width: 0.85rem;
    height: 0.85rem;
    margin-top: 0.2rem;
    border: 2px solid rgba(14, 165, 233, 0.35);
    border-top-color: var(--link);
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}
.active-task-body {
    flex: 1 1 auto;
    min-width: 0;
}
.active-task-title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.active-task-detail {
    font-size: 0.85rem;
    color: var(--muted);
    word-break: break-word;
}

.s3-panel-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-elev);
}

.s3-panel-tab {
    border: 0;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
}

.s3-panel-tab:last-child { border-right: 0; }

.s3-panel-tab:hover {
    color: var(--text);
    background: var(--bg-hover, rgba(127, 127, 127, 0.08));
}

.s3-panel-tab.active {
    background: var(--accent);
    color: var(--accent-text);
}

.s3-conn-ok { color: var(--badge-ok-fg); font-weight: 700; }
html[data-theme="light"] .s3-conn-ok { color: #15803d; }
html:not([data-theme="light"]) .s3-conn-ok { color: #86efac; }
