/* ========================================
   MetaWipe — Image Metadata Remover
   Light + dark theme
   ======================================== */

/* --- Tokens --- */
:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #f0f1f6;
    --surface-3: #e7e8f0;
    --border: #e2e4ec;
    --border-strong: #cdd0dc;

    --text: #13141b;
    --text-2: #555a6e;
    --text-3: #8b8fa3;

    --accent: #5850ec;
    --accent-hover: #4a42d9;
    --accent-soft: #eeedfd;
    --accent-text: #463ed6;
    --on-accent: #ffffff;

    --success: #11904a;
    --success-soft: #e5f5eb;
    --warn: #b76e00;
    --warn-soft: #fdf1dc;
    --danger: #d93d42;
    --danger-soft: #fdeaea;
    --ai: #a136c9;
    --ai-soft: #f6e9fb;

    --shadow-sm: 0 1px 2px rgba(20, 22, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(20, 22, 40, 0.08), 0 1px 3px rgba(20, 22, 40, 0.05);
    --shadow-lg: 0 24px 64px rgba(20, 22, 40, 0.18);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c0d12;
        --surface: #15161d;
        --surface-2: #1c1d26;
        --surface-3: #252733;
        --border: #262835;
        --border-strong: #363949;
        --text: #ececf2;
        --text-2: #a3a6b8;
        --text-3: #6f7286;
        --accent: #7b74ff;
        --accent-hover: #8e88ff;
        --accent-soft: rgba(123, 116, 255, 0.14);
        --accent-text: #a29dff;
        --success: #3fcf7f;
        --success-soft: rgba(63, 207, 127, 0.12);
        --warn: #f0b04a;
        --warn-soft: rgba(240, 176, 74, 0.12);
        --danger: #ff6b70;
        --danger-soft: rgba(255, 107, 112, 0.12);
        --ai: #d78bf5;
        --ai-soft: rgba(215, 139, 245, 0.13);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0c0d12;
    --surface: #15161d;
    --surface-2: #1c1d26;
    --surface-3: #252733;
    --border: #262835;
    --border-strong: #363949;
    --text: #ececf2;
    --text-2: #a3a6b8;
    --text-3: #6f7286;
    --accent: #7b74ff;
    --accent-hover: #8e88ff;
    --accent-soft: rgba(123, 116, 255, 0.14);
    --accent-text: #a29dff;
    --success: #3fcf7f;
    --success-soft: rgba(63, 207, 127, 0.12);
    --warn: #f0b04a;
    --warn-soft: rgba(240, 176, 74, 0.12);
    --danger: #ff6b70;
    --danger-soft: rgba(255, 107, 112, 0.12);
    --ai: #d78bf5;
    --ai-soft: rgba(215, 139, 245, 0.13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
kbd {
    font-family: var(--font);
    font-size: 0.75em;
    font-weight: 600;
    padding: 1px 5px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface);
    color: var(--text-2);
}

.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Logo --- */
.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #6d5cff 0%, #a147e6 100%);
    box-shadow: 0 4px 12px rgba(109, 92, 255, 0.35);
    flex-shrink: 0;
}
.logo-mark svg { width: 20px; height: 20px; }

.logo-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.logo-text span { color: var(--accent); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }

.btn-sm { height: 34px; padding: 0 12px; font-size: 0.85rem; }
.btn-block { width: 100%; height: 46px; font-size: 0.95rem; }

.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-2);
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
    flex-shrink: 0;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.link { color: var(--accent-text); font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; }
.link-btn:hover, .dropzone:hover .link { text-decoration: underline; }

/* Theme toggle icon */
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: none; }
    :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* --- Top bar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    height: 62px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-chip {
    font-size: 0.82rem;
    color: var(--text-2);
    padding: 0 6px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Page --- */
.page {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 32px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* --- Hero --- */
.hero { text-align: center; }
.hero h1 {
    font-size: clamp(1.8rem, 4.2vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.12;
    max-width: 720px;
    margin: 0 auto;
}
.hero h1 .accent {
    background: linear-gradient(120deg, #6d5cff, #b14be0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-sub {
    margin: 14px auto 36px;
    max-width: 560px;
    color: var(--text-2);
    font-size: 1.05rem;
}

.dropzone {
    max-width: 760px;
    margin: 0 auto;
    padding: 52px 24px 40px;
    border: 2px dashed var(--border-strong);
    border-radius: 22px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px var(--accent-soft);
    outline: none;
}
.dropzone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: scale(1.01);
}
.dropzone-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-soft);
    transition: transform 0.25s var(--ease);
}
.dropzone-icon svg { width: 36px; height: 36px; }
.dropzone:hover .dropzone-icon, .dropzone.drag-over .dropzone-icon { transform: translateY(-3px); }
.dropzone h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.dropzone-sub { margin-top: 6px; color: var(--text-2); font-size: 0.95rem; }
.format-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 22px;
}
.format-row span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-2);
}
.dropzone-note { margin-top: 12px; font-size: 0.8rem; color: var(--text-3); }

.features {
    list-style: none;
    max-width: 760px;
    margin: 28px auto 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    text-align: left;
}
.features li { display: flex; gap: 12px; align-items: flex-start; }
.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.feature-icon svg { width: 18px; height: 18px; }
.features strong { display: block; font-size: 0.9rem; }
.features span { display: block; font-size: 0.82rem; color: var(--text-2); line-height: 1.45; }

/* --- Workspace --- */
.workspace { display: flex; flex-direction: column; gap: 16px; animation: fadeUp 0.35s var(--ease); }

.summary { padding: 22px 24px 20px; position: sticky; top: 74px; z-index: 10; box-shadow: var(--shadow-md); }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.summary-head h2 { font-size: 1.25rem; font-weight: 750; letter-spacing: -0.02em; }
.summary-status { font-size: 0.86rem; color: var(--text-2); margin-top: 2px; }
.summary-status .ok { color: var(--success); font-weight: 600; }
.summary-status .bad { color: var(--danger); font-weight: 600; }
.summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.progress {
    height: 4px;
    margin-top: 16px;
    border-radius: 99px;
    background: var(--surface-2);
    overflow: hidden;
    transition: opacity 0.4s var(--ease);
}
.progress.done { opacity: 0; }
.progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #6d5cff, #b14be0);
    transition: width 0.3s var(--ease);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 14px;
}
.stat { padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-2); }
.stat dt { font-size: 0.75rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.stat dd { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: 0.75rem; font-weight: 500; color: var(--text-2); margin-left: 5px; letter-spacing: 0; }
.stat-gps.has dd { color: var(--warn); }
.stat-ai.has dd { color: var(--ai); }

/* --- File list --- */
.file-list { list-style: none; overflow: hidden; }

.file-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 16px;
    border-bottom: 1px solid var(--border);
    animation: fadeUp 0.25s var(--ease) both;
    transition: background 0.15s var(--ease);
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-2); }

.thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ext { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; color: var(--text-3); text-transform: uppercase; }
.thumb .thumb-busy {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.file-main { min-width: 0; }
.file-name { font-size: 0.92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-2);
}
.file-meta .sep { color: var(--text-3); }
.file-meta .err { color: var(--danger); font-weight: 500; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-gps { background: var(--warn-soft); color: var(--warn); }
.chip-ai { background: var(--ai-soft); color: var(--ai); }
.chip-err { background: var(--danger-soft); color: var(--danger); }
.chip-wait { background: var(--surface-3); color: var(--text-2); }

.file-size { font-size: 0.8rem; color: var(--text-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-size b { color: var(--text); font-weight: 600; }

.file-actions { display: flex; align-items: center; gap: 2px; }
.file-actions .btn { height: 34px; padding: 0 12px; font-size: 0.82rem; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--surface-3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.drop-hint { text-align: center; font-size: 0.82rem; color: var(--text-3); }

/* --- Drop overlay --- */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 14%, color-mix(in srgb, var(--bg) 80%, transparent));
    backdrop-filter: blur(3px);
    pointer-events: none;
    animation: fadeIn 0.15s var(--ease);
}
.drop-overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 36px 56px;
    border: 2px dashed var(--accent);
    border-radius: 22px;
    background: var(--surface);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
}
.drop-overlay-box svg { width: 34px; height: 34px; }

/* --- Details drawer --- */
.drawer {
    margin: 0 0 0 auto;
    padding: 0;
    width: min(520px, 100vw);
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
}
.drawer[open] { display: flex; animation: slideIn 0.25s var(--ease); }
.drawer::backdrop { background: rgba(10, 11, 18, 0.45); backdrop-filter: blur(2px); }

.drawer-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 18px 16px 22px;
    border-bottom: 1px solid var(--border);
}
.drawer-thumb { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--surface-3); flex-shrink: 0; display: grid; place-items: center; }
.drawer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.drawer-title-wrap { flex: 1; min-width: 0; }
.drawer-title-wrap h3 { font-size: 1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-title-wrap p { font-size: 0.82rem; color: var(--text-2); margin-top: 2px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer-body > * { flex-shrink: 0; } /* scroll the body instead of squashing the groups */
.drawer-foot { padding: 14px 22px 18px; border-top: 1px solid var(--border); }

.notice {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    border: 1px solid transparent;
}
.notice-title { font-weight: 700; margin-bottom: 6px; }
.notice ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.notice li { display: flex; flex-direction: column; }
.notice li b { font-weight: 600; }
.notice li span { color: var(--text-2); word-break: break-word; }
.notice-note { margin-top: 10px; font-size: 0.78rem; color: var(--text-2); }
.notice-ai { background: var(--ai-soft); border-color: color-mix(in srgb, var(--ai) 25%, transparent); }
.notice-ai .notice-title { color: var(--ai); }
.notice-warn { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.notice-warn .notice-title { color: var(--danger); }
.notice-gps { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice-gps .notice-title { color: var(--warn); margin-bottom: 0; }
.notice-clean { background: var(--success-soft); color: var(--success); font-weight: 600; }

.meta-group { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.meta-group summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    background: var(--surface-2);
    font-size: 0.85rem;
    font-weight: 650;
    cursor: pointer;
    user-select: none;
}
.meta-group summary::-webkit-details-marker { display: none; }
.meta-group summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-3);
    border-bottom: 2px solid var(--text-3);
    transform: rotate(-45deg);
    transition: transform 0.2s var(--ease);
    margin-right: 4px;
}
.meta-group[open] summary::after { transform: rotate(45deg); }
.meta-group summary .count {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 99px;
    background: var(--surface);
    color: var(--text-2);
}
.meta-rows { display: flex; flex-direction: column; }
.meta-row {
    display: grid;
    grid-template-columns: minmax(110px, 38%) 1fr;
    gap: 12px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}
.meta-row dt { color: var(--text-2); font-weight: 500; word-break: break-word; }
.meta-row dd {
    font-family: var(--mono);
    font-size: 0.76rem;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

/* --- Toasts --- */
.toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    background: var(--text);
    color: var(--bg);
    font-size: 0.86rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s var(--ease);
    pointer-events: auto;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all 0.25s var(--ease); }

/* --- Footer --- */
.footer { text-align: center; padding: 20px 24px 28px; }
.footer p { font-size: 0.8rem; color: var(--text-3); }

/* --- Login page --- */
.login-page { justify-content: center; align-items: center; padding: 24px 16px; }
.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(600px 400px at 15% 10%, color-mix(in srgb, #6d5cff 14%, transparent), transparent 70%),
        radial-gradient(500px 400px at 90% 90%, color-mix(in srgb, #b14be0 12%, transparent), transparent 70%);
}
.login-shell { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .logo-mark { width: 38px; height: 38px; border-radius: 11px; }
.login-brand .logo-text { font-size: 1.45rem; }

.login-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px 28px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 1.4rem; font-weight: 750; letter-spacing: -0.02em; }
.login-sub { color: var(--text-2); font-size: 0.9rem; margin: 4px 0 18px; }

.login-error {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 500;
}

.field-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin: 12px 0 6px; }
.field-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.95rem;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.password-wrap { position: relative; }
.password-wrap .field-input { padding-right: 46px; }
.password-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-3);
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle svg { width: 19px; height: 19px; }
.password-toggle .eye-closed { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-closed { display: block; }

.remember {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 20px;
    font-size: 0.88rem;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    position: relative;
}
.remember input { position: absolute; opacity: 0; width: 18px; height: 18px; margin: 0; cursor: pointer; }
.remember-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all 0.15s var(--ease);
}
.remember-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
    opacity: 0;
}
.remember input:checked + .remember-box { background: var(--accent); border-color: var(--accent); }
.remember input:checked + .remember-box::after { opacity: 1; }
.remember input:focus-visible + .remember-box { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-foot { font-size: 0.8rem; color: var(--text-3); text-align: center; }

/* --- Animations --- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- Responsive --- */
@media (max-width: 820px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .features { grid-template-columns: 1fr; max-width: 420px; }
    .summary { position: static; }
}

/* On short screens a sticky summary would hide too much of the list */
@media (max-height: 760px) {
    .summary { position: static; }
}

@media (max-width: 640px) {
    .topbar-inner { padding: 0 16px; }
    .user-chip { display: none; }
    .page { padding: 28px 16px 24px; }
    .hero-sub { font-size: 0.95rem; margin-bottom: 24px; }
    .dropzone { padding: 36px 16px 28px; }
    .summary { padding: 18px 16px 16px; }
    .summary-actions { width: 100%; }
    .summary-actions .btn { flex: 1; padding: 0 10px; }
    .summary-actions #downloadAllBtn { flex-basis: 100%; }
    .stat dd { font-size: 1.15rem; }

    .file-row {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        grid-template-areas: "thumb main actions" "thumb size actions";
        row-gap: 2px;
        padding: 12px;
    }
    .file-row .thumb { grid-area: thumb; width: 48px; height: 48px; align-self: start; }
    .file-row .file-main { grid-area: main; }
    .file-row .file-size { grid-area: size; text-align: left; }
    .file-row .file-actions { grid-area: actions; }
    .file-actions .btn-details-label { display: none; }
    .file-actions .btn { padding: 0 9px; }

    .meta-row { grid-template-columns: 1fr; gap: 2px; }
}
