* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

nav {
    background: #1a1a2e;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a, nav .btn-link { color: #e0e0e0; text-decoration: none; margin-left: 1rem; }
nav a:hover { color: #fff; }
nav .logo { font-weight: bold; font-size: 1.1rem; margin-left: 0; }
nav .btn-link { background: none; border: none; cursor: pointer; font-size: inherit; }

/* User dropdown */
.user-dropdown { position: relative; display: inline-block; margin-left: 1rem; }
.user-dropdown .user-name { color: #e0e0e0; cursor: pointer; }
.user-dropdown .user-name:hover { color: #fff; }
.user-dropdown .dropdown-menu { display: none; position: absolute; right: 0; top: 100%; background: #fff; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 160px; z-index: 100; padding-top: 0.25rem; }
.user-dropdown .dropdown-menu::before { content: ""; position: absolute; top: -0.5rem; left: 0; right: 0; height: 0.5rem; }
.user-dropdown:hover .dropdown-menu { display: block; }
.user-dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: block; width: 100%; padding: 0.5rem 1rem; color: #333; text-decoration: none; text-align: left; border: none; background: none; cursor: pointer; font-size: 0.9rem; margin: 0; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: #f0f0f0; }

main { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
h1, h2 { margin-bottom: 1rem; }

/* Auth forms */
.auth-form {
    max-width: 400px;
    margin: 4rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.auth-form h1 { text-align: center; }
.auth-form label { display: block; margin-top: 1rem; font-weight: 600; }
.auth-form input { width: 100%; padding: 0.5rem; margin-top: 0.25rem; border: 1px solid #ccc; border-radius: 4px; }
.auth-form button { width: 100%; margin-top: 1.5rem; padding: 0.75rem; background: #1a1a2e; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }
.auth-form button:hover { background: #16213e; }
.auth-form p { text-align: center; margin-top: 1rem; }
.error { color: #c0392b; background: #fde8e8; padding: 0.5rem; border-radius: 4px; margin-bottom: 1rem; }
.warning { color: #856404; background: #fff3cd; padding: 0.75rem; border-radius: 4px; margin-bottom: 1rem; border: 1px solid #ffc107; }
.success { color: #27ae60; background: #e8fde8; padding: 0.5rem; border-radius: 4px; margin-bottom: 1rem; }

/* Upload form */
.upload-form {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.form-group input { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.form-group select { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.upload-form button { padding: 0.75rem 2rem; background: #1a1a2e; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }
.upload-form button:hover { background: #16213e; }
.upload-form.form-disabled { opacity: 0.5; pointer-events: none; }

/* Job table */
.job-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.job-table th, .job-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.job-table th { background: #f8f8f8; font-weight: 600; }
.job-table a { color: #2980b9; }

.status-completed { color: #27ae60; font-weight: 600; }
.status-failed { color: #c0392b; font-weight: 600; }
.status-submitting { color: #f39c12; font-weight: 600; }
.status-awaiting_2fa { color: #8e44ad; font-weight: 600; }

/* Progress bar */
#progress-bar-container { background: #e0e0e0; border-radius: 4px; height: 24px; position: relative; margin: 1rem 0; }
#progress-bar { background: #27ae60; height: 100%; border-radius: 4px; transition: width 0.3s; }
#progress-text { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 0.85rem; font-weight: 600; }

/* Log */
#log-area { margin-top: 1.5rem; }
#log-list { list-style: none; background: #fff; padding: 1rem; border-radius: 8px; max-height: 400px; overflow-y: auto; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
#log-list li { padding: 0.25rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }

/* Job status icon */
#status-area { display: flex; align-items: center; gap: 1.25rem; margin: 1.5rem 0; }
.job-spinner { width: 48px; height: 48px; border: 4px solid #e0e0e0; border-top-color: #1a1a2e; border-radius: 50%; animation: job-spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes job-spin { to { transform: rotate(360deg); } }
.job-success, .job-fail { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: bold; flex-shrink: 0; }
.job-success { background: #27ae60; color: #fff; }
.job-fail { background: #c0392b; color: #fff; }

.btn { display: inline-block; padding: 0.5rem 1.5rem; background: #1a1a2e; color: #fff; text-decoration: none; border-radius: 4px; }
.btn:hover { background: #16213e; }
.btn-danger { color: #c0392b; }
.btn-danger:hover { color: #e74c3c; }

/* Action toggle in tables */
.action-toggle { color: #2980b9; cursor: pointer; font-size: 0.9rem; }
.action-toggle:hover { color: #1a6ea0; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 200; justify-content: center; align-items: center; }
.modal { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); max-width: 400px; width: 90%; }
.modal h3 { margin-bottom: 1rem; }
.modal label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.modal input { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.modal button { padding: 0.5rem 1.5rem; border: none; border-radius: 4px; cursor: pointer; color: #fff; background: #1a1a2e; }
.modal button:hover { background: #16213e; }

/* Admin dashboard — host stats cards */
.host-stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 1rem 1.5rem; flex: 1; min-width: 180px; }
.stat-label { font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Admin dashboard — progress bars */
.stat-bar { background: #e0e0e0; border-radius: 4px; height: 8px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 4px; background: #27ae60; transition: width 0.4s, background 0.4s; }

/* Admin dashboard — health badges */
.health-healthy { color: #27ae60; font-weight: 600; }
.health-unhealthy { color: #c0392b; font-weight: 600; }
.health-starting { color: #f39c12; font-weight: 600; }
.health-none { color: #aaa; }

/* Admin dashboard — log viewer */
.log-viewer { background: #1a1a2e; color: #d0d0e8; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 0.8rem; padding: 1rem; border-radius: 8px; max-height: 500px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
