:root {
    --bg: #14171c;
    --panel: #1b1f26;
    --panel-hover: #232833;
    --border: #2a2f3a;
    --text: #e8e6e1;
    --text-muted: #8b93a1;
    --accent: #c9a24b;
    --accent-soft: rgba(201, 162, 75, 0.14);
    --danger: #d9705f;
    --danger-soft: rgba(217, 112, 95, 0.14);
    --success: #5fb88a;
    --radius: 8px;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    height: 100%;
}

button {
    font-family: var(--sans);
    cursor: pointer;
}

input {
    font-family: var(--sans);
}

/* ---------- Auth screens ---------- */

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 15%, rgba(201, 162, 75, 0.07), transparent 40%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 36px 32px;
}

.auth-mark {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
}

.auth-card h1 {
    font-size: 22px;
    margin: 0 0 8px;
    font-weight: 600;
}

.auth-sub {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 24px;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-card input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.auth-card input:focus {
    border-color: var(--accent);
}

.auth-card button[type="submit"] {
    margin-top: 4px;
    background: var(--accent);
    color: #14171c;
    border: none;
    border-radius: var(--radius);
    padding: 11px;
    font-weight: 600;
    font-size: 14px;
    transition: opacity 0.15s;
}

.auth-card button[type="submit"]:hover { opacity: 0.9; }

.auth-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 16px;
}

/* ---------- App shell ---------- */

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

.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    flex-wrap: wrap;
}

.brand {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.02em;
}

.breadcrumb {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    min-width: 160px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.breadcrumb .crumb {
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
}

.breadcrumb .crumb:hover {
    background: var(--panel-hover);
    color: var(--text);
}

.breadcrumb .crumb.current {
    color: var(--text);
    cursor: default;
}

.breadcrumb .crumb.current:hover {
    background: none;
}

.breadcrumb .sep {
    color: var(--border);
    padding: 0 1px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    background: var(--panel-hover);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
}

.btn-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ---------- File list ---------- */

.dropzone {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px 40px;
    position: relative;
}

.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 23, 28, 0.92);
    border: 2px dashed var(--accent);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
}

.dropzone.dragging .drop-overlay {
    display: flex;
}

.drop-overlay-text {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 18px;
}

.file-list-head {
    display: grid;
    grid-template-columns: 1fr 100px 160px 90px;
    padding: 12px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
}

.file-row {
    display: grid;
    grid-template-columns: 1fr 100px 160px 90px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius);
    border-bottom: 1px solid transparent;
}

.file-row:hover {
    background: var(--panel);
}

.col-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    cursor: pointer;
}

.col-name .icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.file-row.is-folder .col-name .icon {
    color: var(--accent);
}

.col-name .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.col-size, .col-modified {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--mono);
}

.col-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.1s;
}

.file-row:hover .col-actions {
    opacity: 1;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 5px;
    display: flex;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--panel-hover);
}

.icon-btn.danger:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-title {
    font-family: var(--mono);
    color: var(--text);
    font-size: 15px;
    margin-bottom: 6px;
}

.empty-sub {
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- Upload tray ---------- */

.upload-tray {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    max-height: 320px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 40;
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.tray-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-family: var(--mono);
    color: var(--text-muted);
}

.tray-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}

.tray-close:hover { color: var(--text); }

.tray-list {
    overflow-y: auto;
    padding: 6px 14px;
}

.tray-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.tray-item:last-child { border-bottom: none; }

.tray-item-name {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 5px;
    color: var(--text);
}

.tray-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.tray-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.15s;
}

.tray-item.error .tray-bar-fill { background: var(--danger); }
.tray-item.done .tray-bar-fill { background: var(--success); }

.tray-item-status {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .topbar { padding: 12px 14px; }
    .dropzone { padding: 8px 14px 40px; }
    .file-list-head, .file-row {
        grid-template-columns: 1fr 70px 40px;
    }
    .col-modified { display: none; }
    .upload-tray { left: 12px; right: 12px; width: auto; }
}
