@import url('https://fonts.googleapis.com/css2?family=HarmonyOS+Sans:wght@400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/harmonyos-sans@1.0.1/css/HarmonyOS_Sans.min.css');

/* ═══════════════════════════════════════════════════════
   REFFT – Full UI Redesign  (Modern Dark Theme)
   ═══════════════════════════════════════════════════════ */

/* ── 1. Design tokens ── */
:root {
    --bg-primary:    #0d1117;
    --bg-secondary:  #161b22;
    --bg-card:       rgba(22, 27, 34, 0.85);
    --bg-card-hover: rgba(30, 37, 46, 0.95);
    --border-color:  rgba(48, 54, 61, 0.8);
    --border-glow:   rgba(88, 166, 255, 0.35);
    --text-primary:  #e6edf3;
    --text-secondary:#8b949e;
    --text-muted:    #484f58;
    --accent-blue:   #58a6ff;
    --accent-green:  #3fb950;
    --accent-orange: #d29922;
    --accent-red:    #f85149;
    --accent-purple: #bc8cff;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.45);
    --shadow-md:     0 4px 16px rgba(0,0,0,.55);
    --shadow-lg:     0 8px 32px rgba(0,0,0,.65);
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     16px;
    --nav-height:    3.5rem;
}

/* ── 2. Global reset / base ── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'HarmonyOS Sans', 'HarmonyOS Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(88,166,255,.04) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(63,185,80,.03)  0%, transparent 55%);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* ── 3. Scrollbar ── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--text-muted); }

/* ── 4. Typography overrides ── */
h4, h5 { color: var(--text-primary); margin: 0 0 .6rem; }
h4 { font-size: 1rem; font-weight: 600; }
h5 { font-size: .88rem; font-weight: 600; }
small { color: var(--text-secondary); }
code  { background: rgba(110,118,129,.15); border-radius: 4px; padding: .1em .35em; font-size: .85em; color: #79c0ff; }
a     { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; opacity: .85; }

/* ── 5. Navigation ── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--nav-height);
    background: rgba(13, 17, 23, .88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(88,166,255,.08);
}
nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: .3rem; }
nav ul:first-child { gap: .6rem; flex-shrink: 1; min-width: 0; }
nav ul:last-child  { gap: .25rem; flex-shrink: 0; }

.nav-logo-icon { font-size: 1.2rem; }
.nav-logo-text {
    font-weight: 700;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}
.nav-subtitle { font-size: .75rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-version { font-size: .68rem; padding: .15rem .45rem; border-radius: 20px; background: rgba(88,166,255,.12); color: var(--accent-blue); border: 1px solid rgba(88,166,255,.25); white-space: nowrap; }

/* Nav pill tabs */
.nav-tab {
    display: flex; align-items: center; gap: .3rem;
    padding: .3rem .65rem;
    border-radius: 20px;
    font-size: .82rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background .18s, color .18s;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
}
.nav-tab:hover { background: rgba(88,166,255,.1); color: var(--text-primary); text-decoration: none; }
.nav-tab.active {
    background: rgba(88,166,255,.18);
    color: var(--accent-blue);
    border-color: rgba(88,166,255,.3);
    font-weight: 600;
    text-decoration: none;
}

/* ── 6. Page layout ── */
.page-layout {
    display: flex;
    gap: 0;
    align-items: flex-start;
    padding: 0;
    height: calc(100vh - var(--nav-height));
}

.panel-left {
    flex: 2.8;
    min-width: 0;
    overflow-y: auto;
    height: 100%;
    padding: 1rem 1rem 1.5rem 1.5rem;
    border-right: 1px solid var(--border-color);
}

.panel-right {
    flex: 2.2;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    padding: 1rem 1.5rem 1.5rem 1rem;
}

.panel-right table { table-layout: fixed; width: 100%; word-break: break-all; }
.panel-right code  { word-break: break-all; }

.panel-section-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 .6rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 900px) {
    nav {
        flex-direction: column;
        height: auto;
        padding: .5rem 1rem;
        gap: .25rem;
        align-items: flex-start;
    }
    nav ul:first-child {
        width: 100%;
    }
    nav ul:last-child {
        width: 100%;
        flex-wrap: wrap;
        gap: .2rem;
    }
    .nav-tab {
        padding: .25rem .5rem;
        font-size: .78rem;
    }
    .page-layout {
        flex-direction: column;
        height: auto;
    }
    .panel-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
    }
    .panel-right {
        padding: 1rem;
        overflow-x: hidden;
        max-width: 100%;
    }
    .folder-row-main { flex-wrap: wrap; }
    .folder-row-badges { flex-wrap: wrap; }
    .add-folder-row { flex-wrap: wrap; }
    .add-folder-row input { min-width: 0; width: 100%; }
    .folder-row-actions { width: 100%; justify-content: flex-end; }
    .grid { grid-template-columns: 1fr; }
    article header { flex-wrap: wrap; }
    .task-card header { flex-wrap: wrap; }
    input[type="range"] { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .folder-row-main { flex-direction: column; align-items: flex-start; }
    .folder-row-info { width: 100%; }
}

/* ── 7. Cards (article) ── */
article {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    transition: border-color .2s, box-shadow .2s, background .2s;
    padding: .75rem 1rem;
    margin: 0;
}
article:hover {
    border-color: rgba(88,166,255,.25);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(88,166,255,.08);
    background: var(--bg-card-hover);
}
article header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 0;
    margin-bottom: .4rem;
    background: none;
    border: none;
}

/* ── 8. Buttons ── */
button, [role="button"] {
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    transition: filter .15s, transform .1s, background .15s, border-color .15s, box-shadow .15s;
    cursor: pointer;
}
button:active, [role="button"]:active { transform: scale(.97); }

/* Primary */
button:not(.outline):not(.secondary):not(.toast-close):not(.close) {
    background: linear-gradient(135deg, #1f6feb 0%, #1a5fa8 100%);
    border: 1px solid rgba(88,166,255,.4);
    color: #fff;
    box-shadow: 0 2px 8px rgba(31,111,235,.3);
}
button:not(.outline):not(.secondary):not(.toast-close):not(.close):hover {
    filter: brightness(1.12);
    box-shadow: 0 4px 14px rgba(31,111,235,.45);
}

/* Outline */
button.outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
button.outline:hover {
    background: rgba(88,166,255,.1);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

/* Secondary outline */
button.outline.secondary {
    border-color: rgba(248,81,73,.3);
    color: var(--accent-red);
}
button.outline.secondary:hover {
    background: rgba(248,81,73,.1);
    border-color: var(--accent-red);
}

/* Small buttons */
.small-btn {
    padding: .2rem .55rem;
    font-size: .75rem;
    margin: 0;
    border-radius: var(--radius-sm);
}

/* Busy spinner override */
[aria-busy="true"] { opacity: .7; pointer-events: none; }

/* ── 9. Form elements ── */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="range"],
select,
textarea {
    background: rgba(13,17,23,.7) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    transition: border-color .18s, box-shadow .18s !important;
}
input[type="text"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(88,166,255,.2) !important;
    outline: none !important;
}
input::placeholder, textarea::placeholder { color: var(--text-muted) !important; }
select option { background: var(--bg-secondary); color: var(--text-primary); }

/* Range slider */
input[type="range"] {
    accent-color: var(--accent-blue);
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Checkbox / switch */
input[type="checkbox"] { accent-color: var(--accent-blue); }

/* ── 10. Table ── */
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
thead th { color: var(--text-secondary); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border-color); padding: .4rem .5rem; background: rgba(22,27,34,.6); }
tbody td { padding: .35rem .5rem; border-bottom: 1px solid rgba(48,54,61,.4); vertical-align: middle; }
tbody tr:hover { background: rgba(88,166,255,.04); }
tbody tr:last-child td { border-bottom: none; }

mark.ok { background: rgba(63,185,80,.2);  color: var(--accent-green); border: 1px solid rgba(63,185,80,.3);  border-radius: 4px; padding: .1em .4em; }
mark.no { background: rgba(72,79,88,.2);   color: var(--text-secondary); border: 1px solid var(--border-color); border-radius: 4px; padding: .1em .4em; }

/* ── 11. Two-column page layout ── */
.breadcrumb { margin-bottom: .75rem; font-size: .85rem; color: var(--text-secondary); }
.breadcrumb a { margin: 0 .1rem; color: var(--accent-blue); }

.file-actions { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; flex-wrap: wrap; }
.file-actions button { margin: 0; }
.file-actions label { display: flex; align-items: center; gap: .35rem; }

/* ── 12. Folder rows (new row-based layout) ── */
.add-folder-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: .75rem;
}
.add-folder-row input {
    flex: 1;
    margin: 0 !important;
}
.add-folder-row button { margin: 0; height: 2.4rem; padding: 0 1rem; white-space: nowrap; flex-shrink: 0; }

.icon-btn {
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: .75rem;
    background: var(--bg-card);
}

.folder-row { border-bottom: 1px solid var(--border-color); }
.folder-row:last-child { border-bottom: none; }

.folder-row-main {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .9rem;
    transition: background .15s;
}
.folder-row:hover .folder-row-main { background: rgba(88,166,255,.04); }

.folder-row-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    min-width: 0;
}
.folder-row-icon { font-size: 1.1rem; flex-shrink: 0; }
.folder-row-text { display: flex; flex-direction: column; min-width: 0; }
.folder-row-name {
    font-weight: 600;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-row-path {
    font-size: .75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-row-badges { display: flex; gap: .35rem; flex-shrink: 0; }
.folder-badge {
    padding: .15rem .5rem;
    border-radius: 20px;
    font-size: .72rem;
    background: rgba(88,166,255,.12);
    color: var(--accent-blue);
    border: 1px solid rgba(88,166,255,.2);
    white-space: nowrap;
}

.folder-row-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

/* ── Folder dest select ── */
.folder-dest-select {
    background: rgba(13,17,23,.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .75rem;
    padding: .2rem .5rem;
    cursor: pointer;
    transition: border-color .18s, color .18s;
    margin: 0;
    height: auto;
}
.folder-dest-select:hover,
.folder-dest-select:focus {
    border-color: var(--border-glow);
    color: var(--text-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(88,166,255,.15);
}
.folder-dest-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.folder-del-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: .2rem .55rem;
    font-size: .75rem;
}

.folder-custom-dir {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .9rem .55rem;
    background: rgba(13,17,23,.45);
    border-top: 1px dashed rgba(48,54,61,.7);
}
.folder-custom-dir input {
    flex: 1;
    margin: 0 !important;
    padding: .2rem .4rem !important;
    font-size: .82rem !important;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: .75rem 0;
}

/* ── 13. File list (collapsible groups) ── */.file-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: .4rem;
    overflow: hidden;
    background: var(--bg-card);
}

.file-group-summary {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: .4rem .65rem !important;
    background: rgba(22,27,34,.6);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary) !important;
    cursor: pointer;
    gap: .5rem;
}
.file-group-summary::before { color: var(--text-muted) !important; }
.file-group-summary input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
    position: relative;
    top: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.file-group-count {
    font-size: .75rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-left: auto;
    flex-shrink: 0;
}

.file-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .65rem;
    border-top: 1px solid rgba(48,54,61,.4);
    cursor: pointer;
    font-size: .82rem;
    transition: background .12s;
}
.file-row:hover { background: rgba(88,166,255,.05); }
.file-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-size { font-size: .75rem; color: var(--text-secondary); flex-shrink: 0; white-space: nowrap; }

.transcode-sticky {
    position: sticky;
    bottom: 0;
    padding: .5rem 0 .15rem;
    background: linear-gradient(to bottom, transparent, var(--bg-primary) 45%);
}
.transcode-btn { width: 100%; margin: 0; }

/* ── 14. Task cards ── */
.task-card {
    position: relative;
    margin-bottom: .5rem;
    padding: .5rem .7rem .5rem 1rem;
    font-size: .82rem;
    border-radius: var(--radius-md);
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: border-color .2s;
}

/* Left status stripe */
.task-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background: var(--text-muted);
}
.task-card.status-running-card::before { background: var(--accent-blue); animation: stripe-pulse 1.5s ease-in-out infinite; }
.task-card.status-done-card::before    { background: var(--accent-green); }
.task-card.status-failed-card::before  { background: var(--accent-red); }
.task-card.status-cancelled-card::before { background: var(--text-muted); }
.task-card.status-pending-card::before { background: var(--accent-orange); }

@keyframes stripe-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

.task-card header {
    display: flex; align-items: center; gap: .4rem;
    padding: 0 0 .25rem; flex-wrap: nowrap; min-width: 0; overflow: hidden;
    background: none; border: none; margin: 0;
}
.task-card header .task-id {
    flex: 1; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    font-size: .75rem; color: var(--text-muted); font-family: monospace;
}
.task-card progress {
    width: 100%; margin: .25rem 0; height: .35rem;
    border-radius: 3px; appearance: none; overflow: hidden;
    border: none; background: rgba(48,54,61,.5);
}
.task-card progress::-webkit-progress-bar   { background: rgba(48,54,61,.5); border-radius: 3px; }
.task-card progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent-blue), #3ec8e4); border-radius: 3px; }
.task-card progress::-moz-progress-bar      { background: linear-gradient(90deg, var(--accent-blue), #3ec8e4); border-radius: 3px; }
.task-card p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: .1rem 0; color: var(--text-secondary); font-size: .78rem; }
.task-card p small { overflow: hidden; text-overflow: ellipsis; display: block; white-space: nowrap; color: var(--text-secondary); }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .1rem .45rem; border-radius: 20px;
    font-size: .7rem; font-weight: 600;
    flex-shrink: 0; white-space: nowrap;
}
.status-running  { color: var(--accent-blue); }
.status-done     { color: var(--accent-green); }
.status-failed   { color: var(--accent-red); }
.status-cancelled{ color: var(--text-muted); }
.status-pending  { color: var(--accent-orange); }

.status-badge.status-running  { background: rgba(88,166,255,.15); border: 1px solid rgba(88,166,255,.3); }
.status-badge.status-done     { background: rgba(63,185,80,.15);  border: 1px solid rgba(63,185,80,.3); }
.status-badge.status-failed   { background: rgba(248,81,73,.15);  border: 1px solid rgba(248,81,73,.3); }
.status-badge.status-cancelled{ background: rgba(72,79,88,.15);   border: 1px solid rgba(72,79,88,.3); }
.status-badge.status-pending  { background: rgba(210,153,34,.15); border: 1px solid rgba(210,153,34,.3); }

/* ── 15. Hardware tiles ── */
.hw-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .6rem;
    margin-top: .6rem;
}

.hw-tile {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: .7rem .4rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    text-align: center; gap: .2rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
    position: relative; overflow: hidden;
}
.hw-tile::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--border-color);
    transition: background .2s;
}
.hw-tile.hw-available { border-color: rgba(63,185,80,.35); }
.hw-tile.hw-available::before { background: linear-gradient(90deg, var(--accent-green), var(--accent-blue)); }
.hw-tile.hw-available:hover { border-color: rgba(63,185,80,.6); box-shadow: 0 0 12px rgba(63,185,80,.15); }

.hw-tile-icon   { font-size: 1.3rem; }
.hw-tile-label  { font-size: .78rem; font-weight: 600; color: var(--text-primary); }
.hw-tile-name   { font-size: .66rem; color: var(--text-muted); font-family: monospace; }
.hw-tile-status { font-size: .68rem; padding: .1rem .4rem; border-radius: 4px; }

/* ── 16. Benchmark ── */
.bench-chart { margin-top: 1rem; }
.bench-bar-wrap { display: flex; align-items: center; margin-bottom: .5rem; gap: .5rem; }
.bench-label { width: 150px; font-size: .82rem; flex-shrink: 0; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bench-bar {
    background: linear-gradient(90deg, #1f6feb, #3ec8e4);
    color: #fff; padding: .22rem .55rem; border-radius: var(--radius-sm);
    font-size: .78rem; font-weight: 600; min-width: 44px; text-align: right;
    transition: width .5s ease;
    box-shadow: 0 1px 6px rgba(31,111,235,.3);
}

.bench-enc-tag {
    display: inline-block; padding: .25rem .7rem; border-radius: 20px;
    font-size: .82rem; cursor: pointer; user-select: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.bench-enc-tag:hover { background: rgba(88,166,255,.1); color: var(--text-primary); border-color: var(--border-glow); }
.bench-enc-active {
    background: rgba(88,166,255,.18) !important;
    color: var(--accent-blue) !important;
    border-color: rgba(88,166,255,.4) !important;
    font-weight: 600;
}
.hw-tile.bench-enc-active {
    outline: 2px solid rgba(88,166,255,.5);
    outline-offset: -2px;
    background: rgba(88,166,255,.08);
}

/* ── 17. Preset cards ── */
.preset-card {
    margin-bottom: .5rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: border-color .2s;
}
.preset-card:hover { border-color: rgba(88,166,255,.25); }

/* ── 18. Notify section (channel cards) ── */
.notify-banner {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .9rem;
    margin-bottom: .9rem;
    border-radius: var(--radius-sm);
    background: rgba(88,166,255,.08);
    border: 1px solid rgba(88,166,255,.2);
    border-left: 3px solid var(--accent-blue);
    font-size: .83rem;
    color: var(--text-secondary);
}

.notify-channel-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: .75rem;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}
.notify-channel-card.is-enabled {
    border-color: rgba(88,166,255,.4);
    box-shadow: 0 0 0 1px rgba(88,166,255,.1), var(--shadow-sm);
}

.notify-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .9rem;
    background: rgba(22,27,34,.5);
    border-bottom: 1px solid var(--border-color);
}
.notify-channel-title { font-weight: 600; font-size: .9rem; }
.notify-toggle-label { margin: 0; display: flex; align-items: center; }

.notify-body {
    padding: .75rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
    transition: opacity .2s;
}
.notify-channel-card.is-disabled .notify-body {
    opacity: .4;
    pointer-events: none;
}

.notify-body input { margin: 0 !important; font-size: .83rem !important; }
.notify-body label { margin: 0; font-size: .8rem; }

.notify-hint { color: var(--text-muted); display: block; font-size: .78rem; margin-top: 0.35rem; }

.notify-test-row { display: flex; align-items: center; gap: .5rem; }

.notify-grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: .4rem; }
.notify-grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }

.notify-autosave-row { display: flex; justify-content: flex-end; margin-top: .25rem; }
.notify-saved-indicator { color: var(--accent-green); }

/* ── 19. Toast notifications ── */
.toast-container {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
    display: flex; flex-direction: column; gap: .5rem; max-width: 420px; width: calc(100vw - 2.5rem);
}
.toast {
    padding: .75rem 1rem; border-radius: var(--radius-md); color: #fff;
    font-size: .88rem; line-height: 1.45;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: toast-in .3s ease;
    word-break: break-word;
    display: flex; align-items: flex-start; gap: .5rem;
    opacity: 1 !important;
}
.toast-body { flex: 1; min-width: 0; }
.toast-close {
    flex-shrink: 0; background: none; border: none; color: rgba(255,255,255,.6);
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; margin-left: .25rem;
    transition: color .15s;
}
.toast-close:hover { color: #fff; }
.toast-info    { background: rgba(26,95,168,.92); border-left: 3px solid var(--accent-blue); }
.toast-success { background: rgba(30,107,58,.92);  border-left: 3px solid var(--accent-green); }
.toast-error   { background: rgba(160,32,32,.92);  border-left: 3px solid var(--accent-red); }
.toast-close-icon {
    background: transparent; border: none; padding: 0; box-shadow: none;
    display: inline; width: auto; cursor: pointer;
}
.toast-close-icon:focus-visible {
    outline: 2px solid rgba(255,255,255,.7);
    outline-offset: 2px; border-radius: 2px;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); max-height: 200px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(30px); max-height: 0; margin-bottom: -.5rem; }
}
.toast-leaving { animation: toast-out .3s ease forwards; pointer-events: none; }

/* ── 20. Dialog ── */
dialog {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
dialog article { background: var(--bg-secondary); border: none; box-shadow: none; }
dialog article header { padding: .75rem 1rem; border-bottom: 1px solid var(--border-color); }
dialog article footer { padding: .75rem 1rem; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }

/* ── 21. Details / Summary ── */
details > summary {
    cursor: pointer; list-style: none; color: var(--text-secondary);
    font-size: .82rem; padding: .2rem 0;
    display: flex; align-items: center; gap: .3rem;
}
details > summary::before { content: '▶'; font-size: .65rem; transition: transform .2s; display: inline-block; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary::-webkit-details-marker { display: none; }

/* ── 22. Footer ── */
footer {
    text-align: center; padding: .75rem 0;
    font-size: .7rem; color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 0;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--text-secondary); }

/* ── 23. Misc helpers ── */
section { min-height: 180px; }
.grid   { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }

/* sys-info block */
.sysinfo-block {
    font-size: .82rem;
    padding: .65rem .85rem;
    border-radius: var(--radius-sm);
    background: rgba(22,27,34,.7);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    line-height: 1.6;
}
.sysinfo-block strong { color: var(--accent-blue); }


/* ── Cleanup items ── */
.cleanup-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: .4rem;
    background: var(--bg-card);
    transition: background .15s;
}
.cleanup-item:hover { background: var(--bg-card-hover); }
.cleanup-can-delete { border-left: 3px solid var(--accent-green); }
.cleanup-skip { border-left: 3px solid var(--accent-orange); opacity: .7; }
.cleanup-filename {
    font-size: .85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ── Resume queue banner ── */
.resume-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 1.25rem;
    background: rgba(63, 185, 80, .12);
    border: 1px solid rgba(63, 185, 80, .4);
    border-radius: var(--radius-sm);
    margin: .5rem 1rem;
    font-size: .88rem;
    flex-wrap: wrap;
}


/* ── Report Modal ── */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .6rem;
    margin: .5rem 0;
}
.report-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: .6rem .8rem;
    text-align: center;
}
.report-stat-card.highlight {
    border-color: var(--accent-green);
    background: color-mix(in srgb, var(--accent-green) 8%, var(--bg-secondary));
}
.report-stat-label {
    font-size: .68rem;
    color: var(--text-muted);
    margin-bottom: .2rem;
    white-space: nowrap;
}
.report-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
