/* ==========================================================================
   Media Share — light, friendly UI
   Soft whites · light grays · gentle accents
   ========================================================================== */

:root {
    --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

    /* Light palette */
    --bg: #f6f7f9;
    --bg-soft: #eef1f5;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e6e9ef;
    --border-strong: #d5dae3;

    --text: #2a3140;
    --text-heading: #1a2030;
    --muted: #6b7385;
    --subtle: #949bab;

    /* Gentle accents */
    --accent: #4f8cff;
    --accent-hover: #3a78f0;
    --accent-soft: #eef4ff;
    --accent-ring: rgba(79, 140, 255, 0.22);

    --teal: #3db8b0;
    --teal-soft: #e8f8f6;
    --amber: #c48a1a;
    --amber-soft: #fff8e8;
    --amber-border: #f0e0b0;
    --green: #2f9d6a;
    --green-soft: #e9f8f0;
    --green-border: #c5e8d4;
    --red: #d94b4b;
    --red-soft: #fef0f0;
    --red-border: #f5cfcf;

    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(26, 32, 48, 0.04);
    --shadow: 0 8px 28px rgba(26, 32, 48, 0.06);
    --shadow-hover: 0 12px 32px rgba(26, 32, 48, 0.1);
    --touch: 44px;
    --max: 960px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(900px 420px at 8% -8%, rgba(79, 140, 255, 0.09), transparent 55%),
        radial-gradient(700px 380px at 100% 0%, rgba(61, 184, 176, 0.08), transparent 50%),
        var(--bg);
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84em;
    background: var(--bg-soft);
    color: var(--text-heading);
    padding: 0.12em 0.4em;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ---------- Header (light) ---------- */
.topbar {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--accent-soft), #f3f7ff);
    color: var(--accent);
    border: 1px solid #dce8ff;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.brand-mark:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    color: var(--accent-hover);
}

.brand-title {
    color: var(--text-heading);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.025em;
    display: block;
}

.brand-title:hover {
    color: var(--accent);
}

.brand-sub {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
}

.topbar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.pill-warn {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: var(--amber-border);
}

/* ---------- Main ---------- */
.main {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 22px 16px 48px;
    flex: 1;
}

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

/* Path bar: breadcrumbs + ZIP */
.path-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    color: var(--muted);
}

.btn-zip {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border: 1px solid #d6e4ff;
    white-space: nowrap;
}

.btn-zip:hover {
    background: #e3edff;
    color: #2f62d4;
}

.btn-zip-card {
    margin: 0 12px 12px;
    width: calc(100% - 24px);
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-zip-card:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border-color: #d6e4ff;
}

/* ZIP prepare overlay */
.zip-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(26, 32, 48, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.zip-overlay[hidden] {
    display: none !important;
}

body.zip-busy {
    overflow: hidden;
}

.zip-overlay-card {
    width: 100%;
    max-width: 360px;
    padding: 28px 24px 24px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
}

.zip-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent);
    animation: zip-spin 0.75s linear infinite;
}

@keyframes zip-spin {
    to { transform: rotate(360deg); }
}

.zip-overlay-title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-heading);
}

.zip-overlay-text {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.zip-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 8px;
}

.zip-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--teal));
    transition: width 0.15s linear;
}

.zip-overlay-pct {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent-hover);
}

.breadcrumbs a {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 8px;
    color: var(--accent);
}

.breadcrumbs a:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.bc-sep {
    color: var(--subtle);
    user-select: none;
    padding: 0 2px;
}

.bc-current {
    font-weight: 800;
    color: var(--text-heading);
    padding: 4px 8px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.9375rem;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.alert-error {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid var(--red-border);
}

/* ---------- Lock card ---------- */
.lock-card {
    padding: 40px 28px 32px;
    text-align: center;
    max-width: 440px;
    margin: 28px auto 0;
}

.lock-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    background: linear-gradient(145deg, var(--amber-soft), #fff);
    border: 1px solid var(--amber-border);
    box-shadow: var(--shadow-sm);
}

.lock-title {
    margin: 0 0 8px;
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    color: var(--text-heading);
    font-weight: 800;
}

.lock-text {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.lock-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.lock-hint {
    margin: 18px 0 0;
    font-size: 0.8125rem;
    color: var(--subtle);
    line-height: 1.45;
}

/* ---------- Fields & buttons ---------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--muted);
}

input[type="password"],
input[type="text"],
input[type="file"] {
    width: 100%;
    min-height: var(--touch);
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    background: var(--surface-2);
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

input[type="file"] {
    padding: 10px 12px;
    background: var(--bg);
}

input:hover {
    border-color: #c5ccd8;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--touch);
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 140, 255, 0.28);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 6px 18px rgba(79, 140, 255, 0.35);
}

.btn-secondary {
    background: var(--text-heading);
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #2c3448;
}

.btn-soft {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid #dce8ff;
}

.btn-soft:hover:not(:disabled) {
    background: #e3edff;
    color: var(--accent-hover);
}

.btn-sm {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.8125rem;
    flex-shrink: 0;
    border-radius: 9px;
}

.btn-download {
    background: var(--teal-soft);
    color: #1f8a83;
    border: 1px solid #c5ebe7;
    text-decoration: none;
}

.btn-download:hover {
    background: #d9f4f1;
    color: #167a74;
}

.btn-preview {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border: 1px solid #d6e4ff;
}

.btn-preview:hover {
    background: #e3edff;
    color: #2f62d4;
}

.btn-info-icon {
    flex: 0 0 auto !important;
    min-width: 38px;
    width: 38px;
    padding: 0;
    font-size: 1rem;
    font-weight: 800;
    background: var(--surface-2);
    color: var(--text-heading);
    border: 1px solid var(--border-strong);
}

.btn-info-icon:hover {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border-color: #d6e4ff;
}

.item-card-sub {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 600;
}

.modal-card--info {
    max-width: 480px;
    max-height: min(90vh, 640px);
}

.info-subtitle {
    margin: -4px 0 12px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-heading);
    word-break: break-word;
    padding-right: 28px;
}

.info-body {
    overflow-y: auto;
    max-height: min(70vh, 520px);
    margin: 0 -4px;
    padding: 0 4px 4px;
    -webkit-overflow-scrolling: touch;
}

.info-loading,
.info-error {
    margin: 0;
    padding: 16px 4px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.info-error {
    color: var(--red);
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.info-table th,
.info-table td {
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.info-table th {
    width: 38%;
    color: var(--subtle);
    font-weight: 700;
    font-size: 0.78rem;
}

.info-table td {
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
}

.info-table tr:last-child th,
.info-table tr:last-child td {
    border-bottom: none;
}

.info-table a {
    color: var(--accent);
    font-weight: 700;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* File preview modal */
.preview-overlay .modal-card--preview {
    max-width: min(960px, 96vw);
    width: 100%;
    max-height: min(92vh, 900px);
    padding: 0;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.preview-title {
    margin: 0;
    font-size: 1rem;
    padding-right: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.preview-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.preview-header .modal-close {
    position: static;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    line-height: 1;
}

.preview-body {
    flex: 1;
    min-height: 200px;
    max-height: calc(92vh - 72px);
    overflow: auto;
    background: #0f1218;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

.preview-loading,
.preview-error {
    padding: 28px 20px;
    color: #c8d0dc;
    font-weight: 600;
    text-align: center;
}

.preview-error {
    color: #f0a0a0;
}

.preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.preview-image {
    max-width: 100%;
    max-height: calc(92vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.preview-video {
    max-width: 100%;
    max-height: calc(92vh - 100px);
    width: 100%;
    background: #000;
    border-radius: 8px;
}

.preview-audio {
    width: min(480px, 100%);
    margin: 40px 16px;
}

.preview-pdf {
    width: 100%;
    height: calc(92vh - 120px);
    min-height: 360px;
    border: 0;
    background: #fff;
    border-radius: 6px;
}

.preview-fallback {
    margin: 10px 0 0;
    font-size: 0.8125rem;
    color: #a8b2c0;
    text-align: center;
}

.preview-fallback a {
    color: #8eb6ff;
}

.preview-content--text {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    background: #1a1f2a;
}

.preview-text {
    margin: 0;
    padding: 16px 18px;
    width: 100%;
    max-height: calc(92vh - 72px);
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #e8ecf2;
    white-space: pre-wrap;
    word-break: break-word;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .item-grid,
    .item-grid--folders {
        grid-template-columns: 1fr;
    }

    .lang-switch {
        order: 10;
        width: 100%;
        justify-content: flex-end;
    }

    .preview-overlay .modal-card--preview {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .preview-body {
        max-height: calc(100vh - 64px);
    }
}

/* ---------- Session unlock chips ---------- */
.session-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--green-soft);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--green);
    font-weight: 600;
}

.inline-form {
    display: inline;
    margin: 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--green-border);
    background: #fff;
    color: var(--green);
    font-size: 0.75rem;
    font-weight: 700;
}

.chip-action {
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}

.chip-action:hover {
    background: var(--surface-2);
    border-color: #a8d9c0;
}

/* ---------- Section headers ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
    padding: 0 2px;
}

.section-label {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--subtle);
}

.section-count {
    font-size: 0.8125rem;
    color: var(--muted);
    font-weight: 600;
}

/* ---------- Unified item cards (folders + files) ---------- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.item-grid--folders {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.item-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
    min-height: 100%;
}

.item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: #cfd8ea;
}

.item-card-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    color: inherit;
    min-height: 0;
}

.item-card-link:hover {
    color: inherit;
}

.item-card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    padding: 14px 16px;
    background: linear-gradient(160deg, #f4f7fb 0%, #eef3f8 100%);
    border-bottom: 1px solid var(--border);
}

.item-card-media.has-logo {
    background: #fafbfc;
    padding: 12px 14px;
}

/* Horizontal / wide logos keep aspect ratio */
.item-card-media.is-wide,
.item-card.has-wide-logo .item-card-media {
    min-height: 88px;
    padding: 12px 16px;
}

.item-card-media.is-locked:not(.has-logo) {
    background: linear-gradient(145deg, var(--amber-soft), #fffdf6);
}

.item-card-media--file {
    min-height: 72px;
    background: var(--bg-soft);
}

.item-card-media--file.icon-image { background: #f3f0ff; }
.item-card-media--file.icon-pdf { background: #fff5f5; }
.item-card-media--file.icon-video { background: #eef4ff; }
.item-card-media--file.icon-audio { background: #e8f8f6; }
.item-card-media--file.icon-archive { background: #fff8e8; }

.item-card-emoji {
    font-size: 1.75rem;
    line-height: 1;
}

.item-card-logo {
    display: block;
    max-width: 100%;
    max-height: 72px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.item-card.has-wide-logo .item-card-logo {
    max-height: 56px;
    max-width: 100%;
    width: 100%;
    object-fit: contain;
}

.item-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 10px;
    flex: 1;
}

.item-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 750;
    color: var(--text-heading);
    letter-spacing: -0.015em;
    line-height: 1.3;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-meta-row {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
}

.item-meta-row dt {
    margin: 0;
    color: var(--subtle);
    font-weight: 600;
}

.item-meta-row dd {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.item-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.item-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px 12px;
    margin-top: auto;
}

.item-card-actions .btn {
    flex: 1;
    min-width: 0;
}

.item-card.is-public-hidden {
    opacity: 0.92;
    border-style: dashed;
}

.item-card.is-admin-hidden {
    border-color: #e0c8f0;
    background: #fcf8ff;
}

.badge-hidden {
    background: #eef1f5;
    color: var(--muted);
    border: 1px solid var(--border-strong);
}

.badge-admin-hidden {
    background: #f5edfb;
    color: #7a4fa0;
    border: 1px solid #e0c8f0;
}

.btn-zip-card {
    margin: 0;
    width: auto;
}

/* Language switcher */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.lang-link {
    color: var(--muted);
    text-decoration: none;
    padding: 4px 6px;
    border-radius: 6px;
}

.lang-link:hover {
    color: var(--accent-hover);
    background: var(--accent-soft);
}

.lang-link.is-active {
    color: var(--text-heading);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.lang-sep {
    color: var(--subtle);
    opacity: 0.6;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-lock {
    background: var(--amber-soft);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

/* Empty state */
.empty-state {
    padding: 52px 28px;
    text-align: center;
}

.empty-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
}

.empty-state h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.empty-state p {
    margin: 0 auto;
    max-width: 28rem;
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.55;
}

/* Upload */
.upload-card {
    margin-top: 18px;
    padding: 20px 18px 22px;
}

.upload-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.upload-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    border: 1px solid #dce8ff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.section-title {
    margin: 0 0 4px;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--text-heading);
    font-weight: 800;
}

.section-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.upload-form {
    display: grid;
    gap: 14px;
}

/* Drag & drop zone */
.dropzone {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--bg) 100%);
    min-height: 148px;
    cursor: pointer;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
    outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.dropzone.is-dragover,
.dropzone.is-page-drag {
    border-color: var(--accent);
    background: #e8f0ff;
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.dropzone.is-uploading {
    opacity: 0.72;
    pointer-events: none;
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px 18px;
    pointer-events: none;
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 10px;
    font-size: 1.35rem;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.dropzone-title {
    margin: 0 0 4px;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.dropzone-hint {
    margin: 0;
    font-size: 0.875rem;
    color: var(--muted);
}

.dropzone-files {
    margin: 12px 0 0;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: #fff;
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-heading);
    word-break: break-word;
}

.dropzone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    font-size: 0;
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.upload-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
}

.upload-status.is-error {
    color: var(--red);
}

.upload-status.is-busy {
    color: var(--accent);
}

.upload-limit-note {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--subtle);
    font-weight: 500;
}

.pill-total {
    background: var(--accent-soft);
    color: var(--accent-hover);
    border-color: #d6e4ff;
}

.pill-breakdown {
    font-weight: 650;
}

.pill-admin {
    background: #eef8f1;
    color: var(--green);
    border-color: var(--green-border);
}

/* Settings gear in header */
.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-heading);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.12s var(--ease);
}

.settings-btn:hover {
    background: var(--accent-soft);
    border-color: #d6e4ff;
    color: var(--accent-hover);
}

.settings-btn:active {
    transform: scale(0.96);
}

.settings-btn-icon {
    font-size: 1.15rem;
    line-height: 1;
    display: block;
}

body.modal-open {
    overflow: hidden;
}

.btn-danger-soft {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.btn-danger-soft:hover {
    background: #fde4e4;
}

.btn-block {
    width: 100%;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(26, 32, 48, 0.35);
    backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 24px 22px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
}

.modal-card--settings {
    max-width: 440px;
    padding: 0;
    overflow: hidden;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--subtle);
    cursor: pointer;
}

.modal-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-heading);
}

.modal-text {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.settings-header {
    padding: 22px 22px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.settings-header .modal-title {
    margin-bottom: 4px;
    padding-right: 28px;
}

.settings-context {
    margin: 0;
}

.settings-locked-note {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--amber);
}

.settings-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.settings-section {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section--danger {
    background: linear-gradient(180deg, transparent, #fffafa);
    margin: 0 -16px;
    padding: 14px 16px;
    border-bottom: 1px solid #f5cfcf;
}

.settings-section-title {
    margin: 0 0 6px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--subtle);
}

.settings-hint {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.45;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-form--spaced {
    margin-top: 10px;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-footer {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* Upload progress overlay */
.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(26, 32, 48, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.upload-overlay[hidden] {
    display: none !important;
}

body.upload-busy {
    overflow: hidden;
}

.upload-overlay-card {
    width: 100%;
    max-width: 340px;
    padding: 32px 28px 28px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
}

.upload-circle {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
}

.upload-circle-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.upload-circle-bg {
    fill: none;
    stroke: var(--border-strong);
    stroke-width: 2.6;
}

.upload-circle-fg {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.6;
    stroke-linecap: round;
    transition: stroke-dasharray 0.12s linear;
}

.upload-circle.is-indeterminate .upload-circle-svg {
    animation: upload-circle-spin 0.9s linear infinite;
}

.upload-circle.is-indeterminate .upload-circle-fg {
    stroke-dasharray: 28, 100;
    transition: none;
}

.upload-circle.is-done .upload-circle-fg {
    stroke: var(--teal, #0d9488);
}

.upload-circle.is-error .upload-circle-fg {
    stroke: #dc2626;
}

@keyframes upload-circle-spin {
    from { transform: rotate(-90deg); }
    to { transform: rotate(270deg); }
}

.upload-circle-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-heading);
    pointer-events: none;
}

.upload-overlay-title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-heading);
}

.upload-overlay-text {
    margin: 0 0 6px;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
    word-break: break-word;
}

.upload-overlay-detail {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--accent-hover);
    min-height: 1.25em;
}

/* Global page drop overlay */
.global-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(79, 140, 255, 0.14);
    border: 3px dashed var(--accent);
    pointer-events: none;
}

.global-drop-overlay[hidden] {
    display: none !important;
}

.global-drop-card {
    text-align: center;
    padding: 28px 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    border: 1px solid #d6e4ff;
}

.global-drop-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.global-drop-title {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-heading);
}

.global-drop-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 8px 16px 32px;
    color: var(--subtle);
    font-size: 0.8125rem;
}

.footer p {
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .topbar-inner {
        padding: 12px 14px;
    }

    .brand-sub {
        max-width: 55vw;
    }

    .main {
        padding: 16px 12px 40px;
    }

    .folder-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .folder-card {
        min-height: 118px;
        padding: 14px;
    }

    .file-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .file-row .btn-download {
        width: 100%;
        margin-left: 58px;
        width: calc(100% - 58px);
    }

    .lock-card {
        padding: 32px 18px 26px;
        margin-top: 12px;
    }
}

@media (min-width: 720px) {
    .upload-form {
        grid-template-columns: 1fr auto;
        align-items: end;
    }

    .upload-form .field:first-of-type {
        grid-column: 1 / -1;
    }

    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

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