:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #0d9488;
    --accent-hover: #14b8a6;
    --error: #ef4444;
    --success: #22c55e;
    --border: #334155;
    --radius: 16px;
    --shadow: 0 20px 60px rgba(0,0,0,0.4);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

.hidden {
    display: none;
}

#page-data {
    display: none;
}

.screen {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 60px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
}

h2 {
    margin: 28px 0 14px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.subtitle {
    margin: 0 0 24px;
    color: var(--text-muted);
}

.small {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 12px 0 6px;
}

label {
    display: block;
    margin: 18px 0 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="password"],
input[type="tel"],
input[type="text"] {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

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

button {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 10px 16px;
    font-size: 0.9rem;
    width: auto;
    margin: 0;
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.message {
    padding: 12px;
    border-radius: 10px;
    margin-top: 16px;
    font-size: 0.95rem;
}

.message.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

#qrcode {
    display: flex;
    justify-content: center;
    margin: 16px 0;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
}

#qrcode img,
#qrcode canvas,
#qrcode table {
    max-width: 220px;
    height: auto;
}

#totp-secret-display {
    display: block;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    word-break: break-all;
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-muted);
    user-select: all;
}

.app-header {
    width: 100%;
    max-width: 700px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.app-header h1 {
    font-size: 1.4rem;
}

.drop-zone {
    width: 100%;
    max-width: 700px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-card);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(13, 148, 136, 0.1);
}

.drop-zone-inner {
    pointer-events: none;
}

.drop-zone input[type="file"] {
    display: none;
}

.icon-large {
    width: 56px;
    height: 56px;
    color: var(--accent);
    margin-bottom: 16px;
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px;
}

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

#upload-progress {
    width: 100%;
    max-width: 700px;
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.progress-bar {
    height: 10px;
    background: var(--bg);
    border-radius: 5px;
    overflow: hidden;
}

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

#upload-results {
    width: 100%;
    max-width: 700px;
    margin-top: 24px;
}

#results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#results-list li {
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.1);
    border-left: 4px solid var(--success);
    border-radius: 10px;
    margin-bottom: 8px;
}

#file-list-section {
    width: 100%;
    max-width: 700px;
    margin-top: 24px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.file-info {
    min-width: 0;
    flex: 1;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-actions {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}

.file-actions a,
.file-actions button {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    min-width: 70px;
}

.file-actions a {
    background: var(--accent);
    color: #fff;
}

.file-actions button {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: none;
    margin: 0;
}

.empty {
    color: var(--text-muted);
    text-align: center;
    padding: 30px;
}

@media (max-width: 480px) {
    .screen {
        padding: 16px;
        padding-top: 30px;
    }

    .card {
        padding: 22px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .file-actions {
        margin-left: 0;
        width: 100%;
    }

    .file-actions a,
    .file-actions button {
        flex: 1;
    }
}
