:root {
    --primary: #0066cc;
    --bg: #f5f7fa;
    --border: #e1e4e8;
    --text: #333;
    --text-light: #666;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* Login screen (UMS QA) */
.login-container {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 5000;
}
.login-box {
    background: #fff; padding: 2.5rem; border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1); border: 1px solid var(--border);
    width: 100%; max-width: 400px;
}
.login-box h2 { margin: 0 0 0.5rem 0; font-size: 1.5rem; }
.login-subtitle { color: var(--text-light); font-size: 0.9rem; margin: 0 0 1.5rem 0; }
.login-error { background: #fff5f5; color: var(--danger); padding: 0.75rem; border-radius: 4px; font-size: 0.9rem; margin-bottom: 1rem; }
.login-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.login-form input {
    width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--border);
    border-radius: 4px; font-size: 1rem; margin-bottom: 1rem;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,102,204,0.2); }
.btn-block { width: 100%; margin-top: 0.5rem; }

/* App shell */
.app-container { display: flex; flex-direction: column; height: 100%; }
.app-header {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 0 1.5rem; height: 60px; display: flex;
    align-items: center; justify-content: space-between;
}
.app-header h1 { margin: 0; font-size: 1.2rem; }
.stats { display: flex; align-items: center; gap: 0.6rem; }
.user-email { color: var(--text-light); font-size: 0.85rem; }

.content-area { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }

/* Toolbar */
.toolbar { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; }
.filter-input, .filter-select {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.9rem;
}
.filter-input { flex: 1; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,102,204,0.15); }

/* Run list */
.run-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.run-card {
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    padding: 1rem 1.1rem; cursor: pointer; transition: box-shadow 0.15s, transform 0.05s;
    border-left: 4px solid #ccc;
}
.run-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.run-card.pass { border-left-color: var(--success); }
.run-card.fail { border-left-color: var(--danger); }
.run-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.run-card-rig { font-weight: 700; font-size: 1rem; }
.run-card-time { color: var(--text-light); font-size: 0.78rem; white-space: nowrap; }
.run-card-id { font-family: 'SF Mono', Consolas, monospace; font-size: 0.78rem; color: var(--text-light); margin-top: 0.15rem; }
.run-card-counts { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.count-pill {
    padding: 0.15rem 0.55rem; border-radius: 12px; font-size: 0.78rem; font-weight: 600;
}
.count-pill.pass { background: #d4edda; color: #155724; }
.count-pill.fail { background: #f8d7da; color: #721c24; }
.count-pill.skip { background: #e2e3e5; color: #383d41; }
.run-card-trigger { margin-top: 0.55rem; font-size: 0.82rem; color: var(--text-light); }
.run-card-trigger code { background: #f0f4f8; padding: 0.05em 0.35em; border-radius: 3px; font-size: 0.85em; }

.empty-state { color: var(--text-light); padding: 3rem; text-align: center; font-size: 0.95rem; }

/* Run detail */
.run-detail { max-width: 1100px; }
.detail-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.4rem; }
.detail-head h2 { margin: 0; font-size: 1.4rem; }
.detail-rig { color: var(--text-light); font-size: 0.95rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.detail-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1rem; }
.detail-card h4 { margin: 0 0 0.5rem 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); }
.detail-card .kv { font-size: 0.88rem; line-height: 1.5; }
.detail-card .kv b { display: inline-block; min-width: 7.5rem; color: var(--text-light); font-weight: 600; }
.detail-card a { color: var(--primary); text-decoration: none; }
.detail-card a:hover { text-decoration: underline; }

.outcome-banner {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.1rem; border-radius: 6px;
    font-size: 1rem; font-weight: 600; margin: 0.5rem 0 1.25rem 0;
}
.outcome-banner.pass { background: #d4edda; color: #155724; }
.outcome-banner.fail { background: #f8d7da; color: #721c24; }

.artifacts-section { margin-top: 1.5rem; }
.artifacts-section h3 { font-size: 1.05rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.artifact-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1.25rem; }
.artifact-link {
    padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 4px;
    background: #fff; font-size: 0.85rem; text-decoration: none; color: var(--primary); cursor: pointer;
}
.artifact-link:hover { background: #eef4fb; }

/* Triage iframe */
.triage-frame { width: 100%; min-height: 600px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* Screenshots gallery */
.screenshot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.screenshot-thumb { cursor: zoom-in; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: #fff; }
.screenshot-thumb img { width: 100%; display: block; }
.screenshot-thumb .cap { padding: 0.35rem 0.5rem; font-size: 0.75rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Lightbox */
.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 6000;
    display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.lightbox img { max-width: 100%; max-height: 100%; box-shadow: 0 0 30px rgba(0,0,0,0.6); }
.lightbox .close { position: absolute; top: 1rem; right: 1.5rem; color: #fff; font-size: 2rem; cursor: pointer; }

/* Buttons */
.btn {
    padding: 0.5rem 1rem; border: 1px solid var(--border); background: #fff;
    border-radius: 4px; cursor: pointer; font-size: 0.9rem;
}
.btn:hover { background: #f5f5f5; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: #0056b3; }
