:root {
    --sidebar-bg: #1b2431;
    --sidebar-hover: #262f3d;
    --sidebar-active: #2f6fed;
    --sidebar-text: #aab2c0;
    --content-bg: #f1f3f6;
    --card-bg: #ffffff;
    --border: #e3e6ec;
    --text: #1f2430;
    --muted: #6b7280;
    --accent: #2f6fed;
    --danger: #e5484d;
    --radius: 8px;
}

* { box-sizing: border-box; }

body.admin-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--content-bg);
    color: var(--text);
}

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 0 24px;
    height: 56px;
}

.admin-topbar .brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 440px;
    margin: 0 auto;
}

.topbar-search input {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.88rem;
}

.topbar-search input::placeholder { color: rgba(255, 255, 255, 0.55); }
.topbar-search input:focus {
    background: rgba(255, 255, 255, 0.14);
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.topbar-search button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 4px 6px;
}

.topbar-search-clear {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0 4px;
}

.brand-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.login-brand h1 .brand-logo {
    width: 44px;
    height: 44px;
}

.admin-topbar .user-area {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-left: auto;
}

.btn-logout {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.85rem;
    cursor: pointer;
}

.admin-shell {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px 4px;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    opacity: 0.7;
}

.site-footer {
    text-align: center;
    padding: 24px 16px 40px;
    color: var(--muted);
    font-size: 0.8rem;
}

.admin-sidebar .sidebar-title {
    color: #fff;
    font-weight: 700;
    padding: 0 20px 16px;
    font-size: 1rem;
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
}

.admin-sidebar nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 11px 20px;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
}

.admin-sidebar nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.admin-sidebar nav a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.admin-content {
    flex: 1;
    padding: 28px 32px;
    min-width: 0;
}

.admin-table td a,
.folder-meta a,
.simple-content a:not([class]) {
    color: var(--accent);
}

.admin-table td a:hover,
.folder-meta a:hover,
.simple-content a:not([class]):hover {
    text-decoration: underline;
}

.simple-content {
    max-width: 760px;
    margin: 40px auto;
    padding: 0 16px;
}

.share-result-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
}

.share-result-card .share-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.share-result-card input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
}

.center-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px;
    text-align: center;
}

.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.admin-page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-danger { background: var(--danger); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: #f7f8fa;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--sidebar-bg);
    color: #fff;
    text-align: left;
    padding: 10px 20px;
    font-weight: 600;
}

.admin-table td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:last-child td:first-child { border-radius: 0 0 0 var(--radius); }
.admin-table tr:last-child td:last-child { border-radius: 0 0 var(--radius) 0; }
.admin-table .empty-row td { text-align: center; color: var(--muted); background: #f7f8fa; }

.admin-table tbody tr:hover { background: rgba(0, 0, 0, 0.02); }

.admin-table .row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-table .row-actions form { display: inline; }
.admin-table .link-action {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
}
.admin-table .link-action.danger { color: var(--danger); }

.copy-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.78rem;
    color: var(--accent);
    cursor: pointer;
    margin-left: 8px;
    white-space: nowrap;
}

.copy-btn:hover { background: #eef4ff; }
.copy-btn.copied { color: #16a34a; border-color: #16a34a; }
.copy-btn.copy-failed { color: var(--danger); border-color: var(--danger); }

.muted { color: var(--muted); font-size: 0.85rem; }

.file-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.file-list li span:first-child { flex: 1; }

.progress-bar {
    flex-basis: 120px;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar.small { flex-basis: 80px; }

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s;
}

.admin-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    background: var(--card-bg);
    margin-bottom: 20px;
}

.admin-dropzone.dragover { border-color: var(--accent); background: #eef4ff; }
.admin-dropzone .muted { color: var(--muted); font-size: 0.85rem; }

.admin-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
}

.admin-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s;
}

.admin-upload-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}

.admin-error {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #fdecea;
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
    font-size: 0.9rem;
}

.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
}

/* --- Login page --- */
.login-screen {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #1b2a5c 0%, #16203f 100%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #fff;
}

.login-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
}

.login-brand h1 {
    font-size: 2.2rem;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand p.tagline {
    color: #b7c1e0;
    margin-bottom: 28px;
}

.login-brand ul {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
}

.login-brand ul li {
    padding: 6px 0;
    color: #dbe1f5;
}

.login-brand ul li::before {
    content: "✓ ";
    color: #4ade80;
    font-weight: 700;
}

.login-brand .footer-note {
    color: #8590b3;
    font-size: 0.85rem;
}

.login-panel {
    flex: 1;
    max-width: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    color: var(--text);
    border-radius: 14px;
    padding: 36px 34px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-card .login-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 16px;
}

.login-card h2 {
    text-align: center;
    margin: 0 0 4px;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.login-card label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 6px;
    margin-top: 16px;
}

.login-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 0.95rem;
}

.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.95rem;
    cursor: pointer;
}

.login-card .login-footer {
    text-align: center;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.8rem;
}

/* --- Search / sort / pagination --- */
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

.search-form input[type="text"] {
    flex: 1;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
}

.btn-plain {
    color: var(--muted);
    text-decoration: underline;
    font-size: 0.85rem;
}

.btn-small {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-small.danger { background: var(--danger); }

.admin-table th a {
    color: #fff;
    text-decoration: none;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 0.85rem;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-links a {
    color: var(--accent);
    text-decoration: none;
}

.pagination-current { color: var(--muted); }

/* --- Per-row password protection widget --- */
.password-details {
    display: inline-block;
    position: relative;
}

.password-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.85rem;
    list-style: none;
}

.password-details summary::-webkit-details-marker { display: none; }

.password-details[open] summary { color: var(--danger); }

.password-details form {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
}

.password-details input[type="password"] {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 150px;
    background: var(--card-bg);
    color: var(--text);
}

/* --- Checksum badge --- */
.checksum {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    color: var(--muted);
}

/* --- Bulk-select / folder meta --- */
.folder-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.folder-meta-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Activity log --- */
.activity-badge {
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* --- QR code panel (download page) --- */
.qr-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.qr-panel img {
    border-radius: 6px;
    background: #fff;
    padding: 6px;
}

/* --- Password-locked share page --- */
.unlock-form {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.unlock-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--card-bg);
    color: var(--text);
}

/* --- Guest upload: TTL / password options --- */
.upload-options {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.upload-options label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--muted);
}

.upload-options select,
.upload-options input {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--card-bg);
}

/* --- Dark mode toggle + theme --- */
.theme-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 6px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 0.95rem;
}

:root[data-theme="dark"] {
    --content-bg: #14161b;
    --card-bg: #1b1e25;
    --border: #2c3038;
    --text: #e6e8eb;
    --muted: #8992a1;
}

:root[data-theme="dark"] .admin-table th {
    background: #10131a;
}

:root[data-theme="dark"] .admin-card-header {
    background: #20242c;
}

:root[data-theme="dark"] .admin-table .empty-row td {
    background: #191c23;
}

:root[data-theme="dark"] .admin-dropzone,
:root[data-theme="dark"] .admin-error {
    background: var(--card-bg);
}

:root[data-theme="dark"] .admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* --- Drive browser: breadcrumbs, toolbar, folder-row drop targets --- */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--muted);
}

.breadcrumbs a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumbs a:hover { text-decoration: underline; }

.drive-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.drive-folder-row td {
    transition: background 0.15s;
}

.drive-folder-row.drop-target-active td {
    background: rgba(47, 111, 237, 0.12) !important;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

.password-details select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card-bg);
    color: var(--text);
    max-width: 180px;
}

.search-location {
    display: inline-block;
    margin-left: 8px;
    font-style: italic;
}
