/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px 22px 48px;
    line-height: 1.55;
}
.app { max-width: 740px; margin: 0 auto; }

/* ── Scrollbars ─────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: var(--sb-width); height: var(--sb-width); }
::-webkit-scrollbar-track        { background: var(--bg2); border-radius: 4px; }
::-webkit-scrollbar-thumb        { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: #505050; }
* { scrollbar-width: thin; scrollbar-color: var(--border2) var(--bg2); }

/* ── Header ──────────────────────────────────────────────────────── */
.header {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    flex-wrap: wrap;
}
.header h1 { margin: 0; font-size: 1.25em; font-weight: 600; color: #e8e8e8; }
.header .ver { font-size: 0.78em; color: var(--text-dim); }

/* ── Mode toggle ─────────────────────────────────────────────────── */
.mode-toggle {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 20px; padding: 3px 5px;
    font-size: 0.82em; cursor: pointer; user-select: none;
}
.mode-toggle .mode-opt {
    padding: 3px 10px; border-radius: 14px;
    transition: background .15s, color .15s;
    color: var(--text-dim);
}
.mode-toggle .mode-opt.active {
    background: var(--accent2); color: #e8ffe8; font-weight: 600;
}

/* ── Theme switcher ──────────────────────────────────────────────── */
.theme-switcher {
    display: flex; align-items: center; gap: 6px;
    margin-left: 8px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 20px; padding: 3px 6px;
    font-size: 0.82em; cursor: pointer; user-select: none;
}
.theme-switcher .theme-opt {
    padding: 3px 9px; border-radius: 14px;
    transition: background .15s, color .15s;
    color: var(--text-dim); white-space: nowrap;
}
.theme-switcher .theme-opt.active {
    background: var(--bg3); color: var(--text); font-weight: 600;
    border: 1px solid var(--border2);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.card-title {
    font-size: 0.75em; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 10px;
}

/* ── Drop zone ───────────────────────────────────────────────────── */
#dropZone {
    border: 2px dashed var(--border2);
    border-radius: var(--radius);
    padding: 24px 20px; text-align: center;
    color: var(--text-dim); cursor: pointer;
    transition: border-color .14s, background .14s;
    user-select: none; margin-bottom: 10px;
}
#dropZone:hover { border-color: var(--accent2); background: #101a14; }
#dropZone.drag  { border-color: var(--accent);  background: #0c1910; color: var(--accent); }
.dz-icon { font-size: 1.5em; display: block; margin-bottom: 4px; pointer-events: none; }

/* ── Inputs ──────────────────────────────────────────────────────── */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.row label { color: var(--text-dim); font-size: 0.87em; white-space: nowrap; }
input[type="text"], input[type="password"], input[type="number"], select {
    background: var(--bg2); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius);
    padding: 6px 10px; font-size: 0.88em; outline: none;
    transition: border-color .13s;
}
input[type="text"]:focus, input[type="password"]:focus,
input[type="number"]:focus, select:focus { border-color: var(--accent2); }
input[type="text"]:disabled, input[type="password"]:disabled,
input[type="number"]:disabled, select:disabled {
    opacity: .45; cursor: not-allowed;
}
input[type="file"] { display: none; }
input[type="number"] { width: 90px; }
.file-btn {
    display: inline-block;
    background: var(--bg2); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius);
    padding: 6px 12px; font-size: 0.87em; cursor: pointer;
    transition: border-color .13s;
}
.file-btn:hover { border-color: var(--accent2); }
input[type="checkbox"] { accent-color: var(--accent); }
input.num-sm { width: 80px; }
input.num-md { width: 110px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg2); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius);
    padding: 6px 13px; font-size: 0.87em; cursor: pointer;
    transition: background .13s, border-color .13s; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg3); border-color: #505050; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary {
    background: #0c2e1e; border-color: var(--accent2);
    color: var(--accent); font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #113d28; border-color: var(--accent); }
.btn-danger {
    background: #281010; border-color: #5a2020; color: #d86060;
}
.btn-danger:hover:not(:disabled) { background: #361515; border-color: #8a3030; }
.btn-warn {
    background: #1e1200; border-color: #604000; color: #d09030;
}
.btn-warn:hover:not(:disabled) { background: #2a1800; border-color: #805a10; }

/* ── File list ───────────────────────────────────────────────────── */
#fileList {
    border: 1px solid var(--border); border-radius: var(--radius);
    max-height: 200px; overflow-y: auto;
    background: var(--bg); font-size: 0.87em;
}
#fileList .empty { color: var(--text-dim); padding: 9px 12px; font-style: italic; }
.fileItem {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 10px; border-bottom: 1px solid var(--border); gap: 8px;
}
.fileItem:last-child { border-bottom: none; }
.fileItem label { display: flex; align-items: center; gap: 6px; cursor: pointer; flex: 1; overflow: hidden; }
.fileItem .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fileItem .fsize { color: var(--text-dim); white-space: nowrap; font-size: 0.84em; }
.fileItem .drag-handle { cursor: grab; color: var(--text-dim); font-size: 1.1em; flex-shrink: 0; }
.fileItem.dragging { opacity: .4; }
.fileItem.drag-over { border-top: 2px solid var(--accent2); }

/* ── Password ────────────────────────────────────────────────────── */
.pw-row input { flex: 1; min-width: 180px; }
#passwordStrength { font-size: 0.82em; font-weight: 600; white-space: nowrap; }
.pw-confirm-row { align-items: center; gap: 8px; margin-top: 8px; }
.pw-confirm-row input { flex: 1; min-width: 180px; }
#confirmMatchMsg { font-size: 0.82em; font-weight: 600; white-space: nowrap; }
#confirmMatchMsg.match    { color: var(--match-color); }
#confirmMatchMsg.nomatch  { color: var(--nomatch-color); }

/* ── Progress ────────────────────────────────────────────────────── */
.progress-wrap { margin-top: 10px; }
.progressBar { width: 100%; height: 5px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progressFill { width: 0%; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }
#progressLabel { font-size: 0.81em; color: var(--text-dim); margin-top: 5px; min-height: 1.2em; }

/* ── Banners ─────────────────────────────────────────────────────── */
.flash-banner {
    font-size: 0.84em; padding: 7px 12px; border-radius: var(--radius);
    margin-bottom: 10px; display: none; align-items: center; gap: 7px;
}
.flash-banner.info    { background: #0c1a28; border: 1px solid #2a5878; color: #7ab0e8; }
.flash-banner.warn    { background: #261a00; border: 1px solid #705000; color: #e0a030; }
.flash-banner.success { background: #091e12; border: 1px solid var(--accent2); color: var(--accent); }
#sizeLimitBanner {
    font-size: 0.82em; color: #c08828; display: none;
    background: #1e1400; border: 1px solid #4a3000; border-radius: var(--radius);
    padding: 5px 10px; margin-top: 6px;
}

/* ── Log ─────────────────────────────────────────────────────────── */
.log-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.log-header .card-title { margin-bottom: 0; }
.log-clear-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 0.81em; padding: 2px 8px; border-radius: 3px;
    flex-shrink: 0;
}
.log-clear-btn:hover { background: var(--bg3); color: var(--text); }
.log {
    background: #090909;
    font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
    font-size: 0.81em; height: 210px; overflow-y: auto;
    padding: 10px 12px; white-space: pre-wrap;
    border: 1px solid var(--border); border-radius: var(--radius);
    color: #80d8a8; line-height: 1.55;
}
.log .log-error   { color: #e05555; }
.log .log-warn    { color: #cc8820; }
.log .log-success { color: #40d888; }
.log .log-info    { color: #60a8e8; }
.log .log-dim     { color: #404040; }

/* ── Settings subsections ────────────────────────────────────────── */
.settings-sub {
    border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px;
}
.expand-toggle {
    display: flex; align-items: center; gap: 7px;
    cursor: pointer; user-select: none;
    font-size: 0.78em; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: 0;
    padding: 4px 0;
}
.expand-toggle:hover { color: var(--text); }
.expand-caret {
    display: inline-block; width: 12px; text-align: center;
    transition: transform .15s; font-style: normal;
    font-size: 0.9em;
}
.expand-caret.open { transform: rotate(90deg); }
.expandable-body { display: none; margin-top: 10px; }
.expandable-body.open { display: block; }

/* ── Advanced mode visibility ────────────────────────────────────── */
.adv-only { display: none; }
body.advanced-mode .adv-only { display: block; }
body.advanced-mode .adv-only.row { display: flex; }
body.advanced-mode .adv-only.chk-row { display: flex; }
.adv-badge {
    display: inline-block; font-size: 0.68em; padding: 1px 6px;
    border-radius: 10px; font-weight: 600; letter-spacing: .03em;
    background: #1a1000; color: #c08030; border: 1px solid #4a3000;
    margin-left: 4px; vertical-align: middle;
}
.locked-note {
    font-size: 0.79em; color: var(--text-dim);
    display: flex; align-items: center; gap: 5px;
}
.locked-note .lock-icon { font-size: 0.95em; }

/* ── Misc components ─────────────────────────────────────────────── */
.keyfile-name {
    font-size: 0.82em; color: var(--text-dim); font-style: italic;
    margin-top: 3px;
}
.warn-box {
    background: #1e1200; border: 1px solid #604000;
    border-radius: var(--radius); padding: 8px 12px;
    font-size: 0.82em; color: #c09030; margin-top: 8px;
}
.warn-box strong { color: #d08040; }
.badge {
    display: inline-block; font-size: 0.72em; padding: 2px 7px;
    border-radius: 20px; font-weight: 600; letter-spacing: .03em;
}
.badge-enc { background: #0c2a1c; color: var(--accent); border: 1px solid #1a5030; }
.chk-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.chk-row label { font-size: 0.88em; cursor: pointer; }
.chk-note { font-size: 0.79em; color: var(--text-dim); margin-left: 22px; margin-top: -3px; }
.passgen-output {
    font-family: 'Cascadia Code', Consolas, monospace;
    font-size: 0.88em; background: var(--bg); border: 1px solid var(--border2);
    border-radius: var(--radius); padding: 7px 10px;
    color: var(--accent); word-break: break-all; min-height: 32px;
    margin-top: 8px; flex: 1;
}
.config-preview {
    background: #060606;
    font-family: 'Cascadia Code', Consolas, monospace;
    font-size: 0.78em; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 8px 10px;
    color: #a0c0ff; overflow-x: auto; white-space: pre;
    max-height: 160px; overflow-y: auto;
    margin-top: 8px;
}
.hex-display {
    font-family: 'Cascadia Code', Consolas, monospace;
    font-size: 0.78em; background: var(--bg);
    border: 1px solid var(--border2); border-radius: var(--radius);
    padding: 5px 8px; color: #90b0e8; word-break: break-all;
    flex: 1; min-width: 0;
}

/* ── Modal ───────────────────────────────────────────────────────── */
#metaModal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.72); z-index: 200;
    align-items: center; justify-content: center;
}
#metaModal.open { display: flex; }
.modal-box {
    background: var(--bg1); border: 1px solid var(--border2);
    border-radius: 7px; padding: 20px 22px;
    max-width: 460px; width: 92%;
}
.modal-box h3 { margin: 0 0 12px; font-size: 1em; color: #e8e8e8; }
.meta-table { width: 100%; border-collapse: collapse; font-size: 0.87em; margin-bottom: 14px; }
.meta-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.meta-table td:first-child { color: var(--text-dim); width: 36%; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

hr.sep { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ═══════════════════════════════════════════════════════════════════
   Utility classes — replace every inline style= in index.html
   so the CSP can enforce style-src 'self' with no unsafe-inline.
   ═══════════════════════════════════════════════════════════════════ */

/* Header badge */
.badge-header { margin-left: 4px; font-size: 0.75em; }

/* Drop zone sub-note */
.dz-note { display: block; font-size: 0.78em; color: var(--text-dim); margin-top: 3px; }

/* Queue info label */
.queue-info { color: var(--text-dim); font-size: 0.83em; }

/* Password helper text */
.pw-hint { font-size: 0.79em; color: var(--text-dim); margin-top: 4px; }

/* Passphrase section rows */
.pp-gen-row { margin-top: 8px; }
.pp-output-row { display: flex; gap: 8px; align-items: center; }
.pp-hint { font-size: 0.79em; color: var(--text-dim); margin-top: 6px; }

/* Keyfile section */
.kf-chk-row { margin-top: 10px; }
.kf-pick-row { display: none; margin-top: 6px; }
.kf-pick-row.visible { display: block; }
.btn-sm { font-size: 0.82em; padding: 5px 9px; }

/* Name mode custom input */
.custom-name-input { display: none; flex: 1; min-width: 120px; }
.custom-name-input.visible { display: block; }

/* Inline dimmed label spans */
.label-dim { color: var(--text-dim); font-size: 0.85em; }
.label-sm  { font-size: 0.81em; color: var(--text-dim); }

/* Encrypt meta indented row */
.chk-indent { margin-left: 20px; }

/* Argon2 rows */
.argon2-top-row { margin-top: 10px; }
.argon2-btn-row { margin-top: 4px; }

/* Salt row */
.salt-row { display: none; margin-top: 10px; }
.salt-row.visible { display: block; }
.salt-input { flex: 1; font-family: monospace; font-size: 0.84em; }

/* AAD section */
.aad-desc { font-size: 0.81em; color: var(--text-dim); margin-bottom: 8px; }
.aad-input-row { display: none; margin-top: 6px; }
.aad-input-row.visible { display: block; }
.aad-input-full { width: 100%; }
.aad-chk-note { margin-left: 0; margin-top: 4px; }

/* Performance section label spans */
.perf-hint { font-size: 0.81em; color: var(--text-dim); }

/* Safety section chk-rows spacing */
.chk-row-spaced { margin-top: 6px; }

/* Decryption section title */
.decrypt-title { margin-bottom: 8px; }

/* Decrypt name input */
.decrypt-name-input { flex: 1; min-width: 160px; }

/* Decrypt hint text */
.decrypt-hint { font-size: 0.79em; color: var(--text-dim); margin-bottom: 8px; }

/* CLI profile button row */
.profile-btn-row { margin-top: 4px; }

/* Config preview (hidden by default) */
.config-preview-hidden { display: none; }

/* Apply settings row */
.apply-row { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Simple settings reset row */
.simple-reset-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; }


/* Flash close button */
.flash-close {
    margin-left: auto; background: none; border: none;
    color: inherit; cursor: pointer; font-size: 1.1em;
    opacity: .6; padding: 0 4px; line-height: 1;
}
.flash-close:hover { opacity: 1; }
